Need a little help with Midi In Anyone ??

Started by wadmixfm, August 27, 2024, 21:08:51

Previous topic - Next topic

wadmixfm

It's your code I used ,all I am doing is advancing a variable to move my cursor and play a sound

It's either the iac driver or core audio has latency that is noticeable

I will send you the code from what you sent me And my additional code
It could be the hardware I am using I will try it with asio and see
Yes its really me :)

wadmixfm

All I have done in your code you sent is

Where you have printed your data to the screen is added my 16 drum sound check
Which is a variable called grid$[pn,line,note]

If grid$[1,0,beat]="1" then playground s1,b1
S1 and b1 are
Loadsound variables allochannel variable

I set the counter to 6 in your code because I am using 1/16 notes

That's it

All the samples are mono 44khz so no pressure there

I always thought syncing with midi had to be sent via midi in and midi out so each device can keep together

Lee





Yes its really me :)

Midimaster

Only in this one line I can see 3 possible bugs:

If grid$[1,0,beat]="1" then playground s1,b1
'S1 and b1 are Loadsound variables allochannel variable

Of course your Grid should not be a string-grid, but an INTEGER array

Global Grid:Int[9,9,16]
Global SoundNr:Int
...
' load all sounds before main loop:
Global Sounds:TSound[9], Channel:TChannel[9]
Sound[0]   = LoadSound("bassdrumm.ogg")
Channel[0] = CueSound( Sound[0] )
....

Repeat
     ....
     If Grid[Style,Track,Beat] = 1 Then PlayGround (Track)
Until AppTerminate()

Function PlayGround(Nr:Int)
    ResumeChannel Channel[Nr]
End function


Second bug is the loading of Sounds, when they should already play. In the example above you see, how you can accelerate this by pre-load the sounds an the play them with ResumeChannel()

But as long as you use the BlitzMax standard audio PlaySound() etc... you will have no chance to get a latency below 50msec.


If you replace the complete audio with the MINIAUDIO module you will get latency below 10msec.


I wrote an example for you to demonstrate how we can use MINIAUDIO to combine a bundle of single sounds to a rhythm pattern, which you can edit in real time. See here:

https://www.syntaxbomb.com/index.php?msg=347061866
...crossing the alps with my bike at the moment

wadmixfm

             Yes I hear what your saying without looking at mycode you can't justify what I am trying to do     when I get home I will send you the whole midi routine with what I want it to do .   All I am bothered about is getting the midi and the playback of the samples to sync up    Sounds simple    With the array ,all I am doing is getting the user to enter the notes on the screen ,this is done on another part of the program and when they are entered they are stored in a multidimensional array The grid$[pn,0,x] is basically all I need    The pn is the pattern number    The 0 is line 1 of 2 lines and the x   Is the step number of each beat to the bar .    The array is stored so it's always resident when the song editor moves on the next number in the list the array is displayed and the loop just plays the sounds      It's very hard to explain in a message it has to be shown

Lee
 
Yes its really me :)

wadmixfm

 Quote from: Midimaster on 9/2/2024, 2:45:21 PM Only in this one line I can see 3 possible bugs:  If grid$[1,0,beat]="1" then playground s1,b1 'S1 and b1 are Loadsound variables allochannel variable  Of course your Grid should not be a string-grid, but an INTEGER array  Global Grid:Int[9,9,16] Global SoundNr:Int ... ' load all sounds before main loop: Global Sounds:TSound[9], Channel:TChannel[9] Sound[0]   = LoadSound("bassdrumm.ogg") Channel
  • = CueSound( Sound
  • ) ....  Repeat       ....      If Grid[Style,Track,Beat] = 1 Then PlayGround (Track) Until AppTerminate()  Function PlayGround(Nr:Int)     ResumeChannel Channel[Nr] End function    Second bug is the loading of Sounds, when they should already play. In the example above you see, how you can accelerate this by pre-load the sounds an the play them with ResumeChannel()  But as long as you use the BlitzMax standard audio PlaySound() etc... you will have no chance to get a latency below 50msec.   If you replace the complete audio with the MINIAUDIO module you will get latency below 10msec.   I wrote an example for you to demonstrate how we can use MINIAUDIO to combine a bundle of single sounds to a rhythm pattern, which you can edit in real time. See here:  https://www.syntaxbomb.com/index.php?msg=347061866  That's actually playsound nor playground 😆
 
Yes its really me :)

wadmixfm

right i am home now

what i will do later is put my code together and send you 2 versions 1 for mac and 1 for windows

i will also put in the zip file the working folder where all the images and kits are so when you run the code it will be referenced to that folder

all you have to do is put the folder in the appropriate path
for windows is C:\Users\Public\
for mac just drop it in the Applications folder

then you will be good to go as long as you have

Import BRL.TimerDefault
Import audio.midi
Import mima.miniaudio
Import BRL.StandardIO
Import brl.D3D9Max2D
Import brl.Max2D
Import Brl.Freetypefont
Import MaxGui.Drivers
Import brl.jpgloader
Import brl.pngloader
Import Brl.SystemDefault 'RequestDir()

as long as these are installed you will be good :)

Can i send you a zip file to your email via syntax or just send you a link to get it from my gdrive ??

Lee


Yes its really me :)

Midimaster

...crossing the alps with my bike at the moment