HISE Logo Forum
    • Categories
    • Register
    • Login

    Logic Pro crash when playing MIDI

    Scheduled Pinned Locked Moved General Questions
    30 Posts 3 Posters 318 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.
    • S
      Sampletekk @d.healey
      last edited by

      @d-healey Thanks! I check!

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

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

        UI script isn't deferred

        Sorry, from Sweden... What does that mean?

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

          @Sampletekk Read this - https://forum.hise.audio/topic/79/scripting-best-practices

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

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

            @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?

            from the Apple AU Development documentation;

            Audio Unit Validation and Testing
            
            Audio Unit Validation with the auval Tool
            Apple strongly recommends validating your audio units using the auval command-line 
            tool during development. The auval tool (named as a contraction of "audio unit 
            validation") comes with OS  X. It performs a comprehensive suite of tests on:
            
            An audio unit’s plug-in API, as defined by its programmatic type
            An audio unit’s basic functionality including such things as which audio 
            data channel configurations are available, time required to instantiate 
            the audio unit, and the ability of the audio unit to render audio
            The auval tool tests only an audio unit proper. It does not test 
            any of the following:
            
            Audio unit views
            Audio unit architecture, in terms of using the recommended model-view-controller 
            design pattern for separation of concerns
            Correct use of the Audio Unit Event API
            Quality of DSP, quality of audio generation, or quality of audio data format 
            conversion
            
            The auval tool can validate every type of audio unit defined by Apple. When you run it, 
            it outputs a test log and summarizes the results with a “pass” or "fail” indication.
            
            For more information, refer to the auval built-in help system. To see auval help text, 
            enter the following command at a prompt in the Terminal application:
            
            auval -h
            
            

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 0
            • 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
                                    • First post
                                      Last post

                                    48

                                    Online

                                    1.7k

                                    Users

                                    11.7k

                                    Topics

                                    102.0k

                                    Posts