October 17, 2021, 14:27:42

Author Topic: I finally Finshed My Specdrum Clone  (Read 1509 times)

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #15 on: June 12, 2021, 17:14:48 »
is this using your mod ??

or can it be used with brl system

Lee

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #16 on: June 12, 2021, 17:48:14 »
minus the spelling mistakes hehe

    original:TAudioSample = LoadAudioSample("snare.ogg")
     
    reverse:TAudioSample = CreateAudioSample(original.length, orignal.hertz, original.format)
    ReadPointer:Short Ptr  = original.Samples
    WritePointer:Short Ptr = reverse.Samples
     
    For local i%=0 to original.length-1
       WritePointer = ReadPointer[originl.length-1-i]
    Next

 :)) :))

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #17 on: June 12, 2021, 20:07:30 »
cannot get it to play the sample thats loaded

any insight please

Lee


« Last Edit: June 12, 2021, 21:40:04 by wadmixfm »

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: I finally Finshed My Specdrum Clone
« Reply #18 on: June 12, 2021, 21:57:00 »
can you send one of the (non working) audio files as attachment? I will check it and send you the code to reverse it.

the code to reverse the sound depends on the format the file uses.

the code to play it is of course
Code: [Select]
sound:TSound=LoadSound(reverse)
PlaySound sound
this is traditionalBlitzMax TSound approach. You do not need MiniAudio to reverse sounds. (But you can of course too)

sorry for the typos. but I wrote it direct into the post without checking it in the IDE. I was only for showing the way, not for copying it.

« Last Edit: June 12, 2021, 22:00:04 by Midimaster »
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #19 on: June 12, 2021, 23:10:33 »
Thanks peter :)

i am just about to upload my SpecDrum Clone

the other day you wrote to me and asked about my Spectrum clone :)

Noooo this is a drum machine simulation of an old piece of Spectrum software

Lee

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #20 on: June 13, 2021, 00:01:13 »
i am having a little trouble uploading my zip files

is it because i am new

lee


Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #21 on: June 13, 2021, 01:20:31 »
here you go peter i cannot get this working

have a look please

lee

Code: [Select]
Import mima.miniaudio
Global MiniAudio:TMiniAudio=New TMiniAudio
Function MyCallBack(a:Byte Ptr, PlayBuffer:Short Ptr, RecordingBuffer:Short Ptr, Frames%)
' do something with the samples
End Function
MiniAudio.OpenDevice( MiniAudio.PLAYBACK, Miniaudio.FORMAT_S16, 2, 44000, MyCallBack)

MiniAudio.StartDevice()

Local original:TAudioSample = LoadAudioSample("C:\Users\Public\Specdrum\Kits\Standard\02 Snare.ogg")
     
Local reverse:TAudioSample = CreateAudioSample(original.length, original.hertz, original.format)
Local ReadPointer:Short Ptr  = original.Samples
Local WritePointer:Short Ptr = reverse.Samples
     
For Local i%=0 To original.length-1
WritePointer = ReadPointer[original.length-1-i]
Next
Local sound:TSound = LoadSound(reverse)
PlaySound sound

Input "Press any key to continue"

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: I finally Finshed My Specdrum Clone
« Reply #22 on: June 13, 2021, 09:50:44 »
you had a little typo in the code:
Code: [Select]
WritePointer = ReadPointer[original.length-1-i]needs to be:
Code: [Select]
WritePointer[i] = ReadPointer[original.length-1-i]
and there is no need for using the miniaudio. so this is enough:
Code: BlitzMax
  1. Local original:TAudioSample = LoadAudioSample("Snare.ogg")
  2. Print original.format + " " +   SF_STEREO16LE  
  3. Print original.hertz
  4. Print original.length
  5. Local reverse:TAudioSample = CreateAudioSample(original.length, original.hertz, original.format)
  6. Local ReadPointer:Short Ptr  = original.Samples
  7. Local WritePointer:Short Ptr = reverse.Samples
  8.      
  9. For Local i%=0 To original.length-1
  10.  WritePointer[i] = ReadPointer[original.length-1-i]
  11. Next
  12. Local sound:TSound = LoadSound(reverse)
  13. PlaySound sound
  14.  
  15. Input "Press any key to continue"
« Last Edit: June 13, 2021, 10:45:00 by Midimaster »
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #23 on: June 13, 2021, 14:32:50 »
i am using the miniaudio because its on windows only

and its just imported into the main program you see so i thought i would use it as my program uses it and even though i want the samples reversed i still need to hear them with the latency provided especially when a key is pressed , with miniaudio its instantaneous but with directsound or freeaudio its 150ms to 180ms and its now very noticeable.
Quote
you had a little typo in the code:
Code: WritePointer = ReadPointer[original.length-1-i]

Quote
needs to be:Code: WritePointer = ReadPointer[original.length-1-i]
This is the code you sent me :)

Lee
« Last Edit: June 13, 2021, 14:35:35 by wadmixfm »

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #24 on: June 13, 2021, 14:38:04 »
incidentally once the file has been reversed , can i just save out the file using the file options?
lee



Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: I finally Finshed My Specdrum Clone
« Reply #25 on: June 13, 2021, 18:58:24 »
incidentally once the file has been reversed , can i just save out the file using the file options?
lee
therefore you would now need MiniAudio. But also with MiniAudio it is only possible to save it as WAV, not as OGG. So why not keep the orignal and during loading you build the reversed sound too.
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #26 on: June 13, 2021, 20:17:28 »
no its because i have a drumkit editor and saving them as wavs is not feasible.

not to worry i will edit my code so that my program loads them into memory and when you press R to reverse them it will save that file to the kit folder you are creating

i will use my audio editor to create the reversed sounds and stick them in each drum folder as 01 murD ssaB and over the slot will add the R so the user knows its Reversed :)

its a cheats way but there are only 10 samples per folder each sample is about 1 sec in length so each one is around 6k

not too bad

lee

 
« Last Edit: June 13, 2021, 20:20:34 by wadmixfm »

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: I finally Finshed My Specdrum Clone
« Reply #27 on: June 14, 2021, 08:20:37 »
here you go peter i cannot get this working
..
Code: [Select]
Import mima.miniaudio
Global MiniAudio:TMiniAudio=New TMiniAudio
Function MyCallBack(a:Byte Ptr, PlayBuffer:Short Ptr, RecordingBuffer:Short Ptr, Frames%)
' do something with the samples
End Function
MiniAudio.OpenDevice( MiniAudio.PLAYBACK, Miniaudio.FORMAT_S16, 2, 44000, MyCallBack)

MiniAudio.StartDevice()

Local original:TAudioSample = LoadAudioSample("C:\Users\Public\Specdrum\Kits\Standard\02 Snare.ogg")
...
Local sound:TSound = LoadSound(original)
PlaySound sound

Input "Press any key to continue"

The way you tried to implement MiniAudio does not work that way! As long as use PlaySound() you still do not use the MiniAudio-Library. Using MiniAudio would mean to have a complete different approach. PlaySound() still uses the old FreeSoundDriver even when you defined MiniAudio.

As long as you are happy with PlaySound() there is no need to use MiniAudio. PlaySound() has a lot of advantages and is still the "state of art"-way of firing audios. Only if you feel any limitation of PlaySound() you might want to chance to Miniaudio. But this means to complete design new your audio code.

With MiniAudio you have no longer something like a PlaySound() command. You would fire your samples via the MyCallBack() directly into the "speakers". It is like a last central port where you can only throw in "already mixed final sample values". 10msec later they are already at the speaker. This means if you like to fire two sounds at the same time you would need to combine them "manually" and then fire the result into the MyCallBack.

PlaySound() instead uses a big blackbox where you can throw in different sounds with various parameters at any time. And the blackbox cares about transforming and mixing them together and puts them into a ringbuffer, from where they are performed, when the time has come. This is very comfortable.

The target of MiniAudio is not to be a replacement for FreeAudio (PlaySound()), but a additional way to fire audios, where Freeaudio has limitations:
  • Capture (Recording)
  • more tracks bejond MONO/STEREO
  • using USB-hardware devices
  • mixing together more that 8 sounds at the same time
  • using high quality formats like 32bit-FLOAT
  • opening MP3, WAV, FLAC, multichannel-OGG
As long as you need none of these features there is no reason to use MiniAudio.




« Last Edit: June 14, 2021, 08:24:53 by Midimaster »
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: I finally Finshed My Specdrum Clone
« Reply #28 on: June 14, 2021, 09:43:13 »
Reverse Sounds

Why not use a "LoadReverse()" function instead of adding all the files a second time?

i will use my audio editor to create the reversed sounds and stick them in each drum folder as 01 murD ssaB and over the slot will add the R so the user knows its Reversed :)
its a cheats way but there are only 10 samples per folder each sample is about 1 sec in length so each one is around 6k
lee

Code: BlitzMax
  1. Local MyReverseSnare:TAudioSample=LoadReverseAudioSample("Snare.ogg")
  2.  
  3. Function LoadReverseAudioSample:TAudioSample(Url:String)
  4.         Local temp:TAudioSample = LoadAudioSample(Url)
  5.         Local reverse:TAudioSample = CreateAudioSample(temp.length, temp.hertz, temp.format)
  6.         Local ReadPointer:Short Ptr  = temp.Samples
  7.         Local WritePointer:Short Ptr = reverse.Samples      
  8.         For Local i:Int=0 To temp.length-1
  9.                 WritePointer[i] = ReadPointer[temp.length-1-i]
  10.         Next
  11.         Return reverse
  12. End Function
  13.  
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline wadmixfm

  • Full Member
  • ***
  • Posts: 138
Re: I finally Finshed My Specdrum Clone
« Reply #29 on: June 14, 2021, 19:31:50 »
hmmmmm ok explain this to me then

when using freeaudio on windows 10 without your miniaudio being present i get a latency of 130ms and using playsound

but when i add your driver like in the code and use playsound the latency drops to 20ms

whats running my sound ???

its not using directsound freeaudio or and brl audio system because i have not imported them

lee

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal