HISE Logo Forum
    • Categories
    • Register
    • Login

    Logic Pro crash when playing MIDI

    Scheduled Pinned Locked Moved General Questions
    31 Posts 3 Posters 386 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LindonL
      Lindon @Sampletekk
      last edited by Lindon

      @Sampletekk said in Logic Pro crash when playing MIDI:

      @Sampletekk said in Logic Pro crash when playing MIDI:

      @Lindon said in Logic Pro crash when playing MIDI:

      @Sampletekk said in Logic Pro crash when playing MIDI:

      I've tested one of my AU instruments in progress on Logic Pro 10.7.4, running on OS 13.6.1. When playing a midi file and starting/stopping, it will cause Logic to crash. Anyone else experiencing this?
      Just loading instrument and playing it works, it's when starting/stopping a midi-file that it happens.

      What is AUVal telling you?

      What's AUVal?

      Skärmavbild 2025-05-08 kl. 15.57.51.png

      Looks fine

      That's not Auval thats Plug-In manager...

      HISE Development for hire.
      www.channelrobot.com

      1 Reply Last reply Reply Quote 0
      • S
        Sampletekk @d.healey
        last edited by Sampletekk

        @d-healey said in Logic Pro crash when playing MIDI:

        @Sampletekk said in Logic Pro crash when playing MIDI:

        Here's the snippet of the project,

        UI script isn't deferred and messing with Messages in the UI script is not a good combination. I would start there.

        I realize there's a lot to learn here! Would you suggest putting the messages in scriptprocessors? For instance, these, that now are in onNoteOn callback in the UI script into a scriptprocessor for the sampler that triggers the samples when playing a note?

        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @Sampletekk
          last edited by

          @Sampletekk I recommend everyone always adds Synth.deferCallbacks(true); in the on init of their Interface script. It's very rare that you wouldn't want this.

          Once you do this HISE will start giving you some errors if you try and do non-deferred stuff in the on note on callback. Anything it complains about you can move to a separate (non-deferred) MIDI processor.

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          S 1 Reply Last reply Reply Quote 0
          • S
            Sampletekk @d.healey
            last edited by

            @d-healey So, by putting Synth.deferCallbacks(true); in the onInit interface script you don't need to ad it to other callbacks in interface scripts, that's the only place you should put it?

            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @Sampletekk
              last edited by

              @Sampletekk Correct

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 0
              • S
                Sampletekk
                last edited by Sampletekk

                Is there a tutorial, or text, that explains what would go in a MIDI-thread, and what goes in a audio-thread.
                For instance, in this code, what should not be in the UI-script?

                function onNoteOn()
                {
                	var inVel = Message.getVelocity();
                	var newVel;
                	var noteNumber = Message.getNoteNumber();
                    var Id = Message.getEventId();
                    var velo = Message.getVelocity();
                    if (velo == 1)
                    {
                    	Message.ignoreEvent(true);
                    }
                    
                    noteNumber = noteNumber - 21;	
                	//Console.print(noteNumber);
                	//Console.print(Id);
                	
                	for (i = 0; i < keys.length; i++)
                	{
                		//Console.print(keys[i]);
                	}
                	
                	//Console.print(keys[noteNumber]);
                
                    Synth.addPitchFade(Id, 0, 0, keys[noteNumber]);
                
                    if (transValue == 1)
                    {
                    	switch (noteNumber)
                    	{
                    		case 4:
                    		{
                    			//Synth.playNote(24, 1); 
                    			Message.ignoreEvent(true);
                    			break;
                    		}
                    		case 3:
                    		{
                    			//Synth.playNote(25, 1); 
                    			Message.ignoreEvent(true);
                    			break;
                    		}
                    	}
                    }	
                }
                 
                
                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @Sampletekk
                  last edited by

                  @Sampletekk said in Logic Pro crash when playing MIDI:

                  MIDI-thread, and what goes in a audio-thread.

                  There is the message thread, non-realtime - things related to the UI for example. And there is the audio thread where you put stuff that needs to happen in realtime like responding to keyswitches, legato scripting, etc.

                  @Sampletekk said in Logic Pro crash when playing MIDI:

                  what should not be in the UI-script?

                  If you defer your script you'll get error message when you try to do something that you shouldn't be doing.

                  Anything that changes messages, such as Message.ignoreEvent() or Synth.addPitchFade(Id, 0, 0, keys[noteNumber]); for example.

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Sampletekk @d.healey
                    last edited by

                    @d-healey What would be the best practice to pass data between UI scripts and non-UI scripts? Write functions or by using variables?

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Sampletekk
                      last edited by

                      @Sampletekk Christoph explained it in that post I linked to. https://forum.hise.audio/topic/79/scripting-best-practices

                      But what if you want to control the behaviour of a MIDI processing script with your interface? Theoretically it would be simpler to combine interface and MIDI processing in this case. But I would suggest using two Script Processors and communicate between them using the standard setAttribute way:

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      1 Reply Last reply Reply Quote 0
                      • S
                        Sampletekk
                        last edited by

                        I might be stupid, but I can't figure this out. Yes, I understand that things that should be in the Audio-thread, should not be in the UI-scipts, so I need to place that code in another script, that is not defered.
                        Should I make a new Script Processor and put the Audio stuff i there? Like this, (Script Processor1)
                        Skärmavbild 2025-05-12 kl. 11.27.44.png
                        If so, should the code that was in the "On Note" callback in the Interface script, go into the "On Note" callback in the new "Script Processor1"?
                        And, how will I know that the code in the two "On Note" callbacks in the different script processors are executed in the correct order.
                        I realize that this probably is stupid, but bare with me, my first language was Cobol....

                        LindonL 1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @Sampletekk
                          last edited by

                          @Sampletekk said in Logic Pro crash when playing MIDI:

                          I might be stupid, but I can't figure this out. Yes, I understand that things that should be in the Audio-thread, should not be in the UI-scipts, so I need to place that code in another script, that is not defered.
                          Should I make a new Script Processor and put the Audio stuff i there? Like this, (Script Processor1)
                          Skärmavbild 2025-05-12 kl. 11.27.44.png

                          generally yes.

                          If so, should the code that was in the "On Note" callback in the Interface script, go into the "On Note" callback in the new "Script Processor1"?

                          depends on the code thats in the On Note callback - but as a general rule - yes..

                          And, how will I know that the code in the two "On Note" callbacks in the different script processors are executed in the correct order.

                          They execute in a top down order - so your instruments onNote first then down thru the tree...

                          I realize that this probably is stupid, but bare with me, my first language was Cobol....

                          HISE Development for hire.
                          www.channelrobot.com

                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @Lindon
                            last edited by

                            @Lindon said in Logic Pro crash when playing MIDI:

                            They execute in a top down order - so your instruments onNote first then down thru the tree...

                            I think we can't be 100% certain about this. Since they are running on two different threads, the one on the audio thread will have priority.

                            @Sampletekk said in Logic Pro crash when playing MIDI:

                            If so, should the code that was in the "On Note" callback in the Interface script, go into the "On Note" callback in the new "Script Processor1"?

                            As Lindon says, it depends on the code. But if the code is affecting Messages then yes. If the code is updating or changing things on the UI then no.

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            1 Reply Last reply Reply Quote 1
                            • S
                              Sampletekk
                              last edited by

                              Found the problem!

                              Logic Pro crashed when playing a MIDI file and starting/stopping the playback

                              After stripping down the instrument part by part, I could isolate the problem.
                              I have a sampler that plays hammerback sound, that is, the sound of the piano hammers, falling back after releasing a key.
                              It turned out that the Release Trigger MIDI processor for that sampler had the Time Attenuate activated, for some obscure reason, or mistake... When I deactivated that, Logic worked as it should.
                              I also have regular release samples that has the Time Attenuator activated, as it should, but the the curve is reversed, sinve I wan't those samples to trigger at a lower volume the longer a key has been pressed prior to release.

                              If the thing that caused Logic to crash was the combination of these two release samples, or only the Hammerback, I don't know, but when I, or anyone else, have more time and want to do a test, it might be a good idea. This was the AU version, and only on Logic Pro

                              Skärmavbild 2025-05-13 kl. 13.49.06.png

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              51

                              Online

                              1.7k

                              Users

                              11.7k

                              Topics

                              102.1k

                              Posts