September 21, 2021, 02:26:03

Author Topic: My Music Editor  (Read 5656 times)

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: My Music Editor
« Reply #75 on: July 18, 2021, 07:37:02 »
Quote
...maybe something is wrong with the save function...
Yes, someting is wrong

Because you always define the TAudioSample 4times too big, it looks like the defining of the CreateStaticBank() would be correct:
wrong:
Code: [Select]
Method SaveSample(MySample:MySample_Type, SampleFilename:String = "")
....
'Create a bank from the Samples
SndBank = CreateStaticBank(MySample.Sample.samples, MySample.Sample.length)
...
'Write wav sound data
SndBank.Write(FileStream, 0, MySample.Sample.length)


correct:
Code: BlitzMax
  1. Method SaveSample(MySample:MySample_Type, SampleFilename:String = "")
  2.         ....
  3.         BlockAlign = CHANNELS * BITRATE /8
  4.         ....
  5.         'Create a bank from the Samples
  6.         SndBank = CreateStaticBank(MySample.Sample.samples, MySample.Sample.length*BlockAlign)
  7.         ...
  8.         'Write wav sound data
  9.         SndBank.Write(FileStream, 0, MySample.Sample.length*BlockAlign)
  10.  
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2450
Re: My Music Editor
« Reply #76 on: July 18, 2021, 11:26:06 »
@Midimaster
Now if I recall...  ;D
wasn't it mentioned that banks were not the best way to store things?

Code: [Select]
MySample.Sample.samples, MySample.Sample.length
surely it would have been much simpler for you to program the interface to be:
Code: [Select]
MySample.samples, MySample.length
and of the sake of clarity:
Code: [Select]
BlockAlign = CHANNELS * BITRATE /8
        ....
        'Create a bank from the Samples
        SndBank = CreateStaticBank(MySample.Sample.samples, MySample.Sample.length*BlockAlign)

BlockAlign is something you have conjoured up to fix the save issue you created.

Code: [Select]
SndBank = CreateStaticBank(MySample.Sample.samples, MySample.Sample.length)is a very logical was to think about the data and deal with it...

But of course I know absolutely NOTHING about audio and am talking out of my bottom...
 ;D

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: My Music Editor
« Reply #77 on: July 18, 2021, 12:58:33 »
@Midimaster
Now if I recall...  ;D
wasn't it mentioned that banks were not the best way to store things?

No! It wasn't mentioned! not by me, not by anybody else! And again: I did not write this code! Why asking me?
btw... the Banking thing is one of the thing which is working in his code!

Quote
surely it would have been much simpler for you to program the interface to be:
Code:
MySample.samples, MySample.length

Again, dear IWasAdam. I cases of SF_STEREO16LE and SF_MONO16LE the 1.50 BlitzMax function Samples.Length() does NOT report the size of the TAudioSample in Bytes! Call it a feature, I would call it a bug! And also a 2sec CreateAudioSample() does not allocate 88.200 Byte when you write ...
Code: [Select]
CreateAudioSample(44100*2, 44100, SF_STEREO16LE ...., but 352.800 !!!
And this...
Code: [Select]
CreateAudioSample(88200, 44100, SF_MONO16LE not 88000, but 176.400 !!!

So you cannot use Sample.Length()  to calculate the saving size, but it needs to be
 
SizeInBytes = Sample.Length()*CHANNELS*BITRATE /8


If you of course define a 2sec. SampleBuffer wrongly to big:
Code: [Select]
CreateAudioSample (44100*8, 44100, SF_STEREO16LE ...you can now use Sample.Length (352.000) to save the Audio. Because the wrongly calculated Sample.Length is now exactly the same result a correct defined Sample.Length()*CHANNELS*BITRATE /8 would deliver too.
Only dis-advantage in this calculation: The TAudioSample will mysteriously play longer than 2 seconds: exactly 8 seconds.

Quote
But of course I know absolutely NOTHING about audio and am talking out of my bottom...
 
I don't know which part of your body you use to produce thinking and talking... but it is "not the best" writing style coming out!

« Last Edit: July 18, 2021, 13:07:35 by Midimaster »
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 737
  • nothing is personal
Re: My Music Editor
« Reply #78 on: July 18, 2021, 13:59:21 »
This is a quick response, Ill detail later..

Perhaps you missed what I've said..
Everything is working Perfect!

I mean Everything!

My method worked along with all your advices dear people.

Ill optimize the resolution of displaying the Sample later.. now that it works it should be easy..
Before I play a Sample I divide the length by 4
and the restore it back by multiplying by 4

For some reason that works, and the ChannelPlaying reports exactly when the sample ends..


...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2450
Re: My Music Editor
« Reply #79 on: July 18, 2021, 15:16:57 »
Quote
I don't know which part of your body you use to produce thinking and talking... but it is "not the best" writing style coming out!
It's the part that rewrote the entire blitzMax audio code to support full audio synthesis in c++ with no help and no complaints.
It's the part that wrote the entire audio sub system to support up to 2048 simultaneous voices with no latency and no playback slowdown
It's the part that created filters, lfo and envelope system with a cross matrix on individual voices
It's the part that created the entire UI, sequencer, timing systems, programmable effects core, 3d audio display...

And it's the part that knows NOTHING about what I am talking about - think on that

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2768
  • I mostly code at night... Mostly.
    • SyntaxBomb - Indie Coders
Re: My Music Editor
« Reply #80 on: July 18, 2021, 20:35:13 »
It's the part that...

It's the part that wrote QasarBeach ( iWasAdam not me as I'm dumb like that )
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Mac mini (2020 ), M1 SoC, 8 GB LPDDR4, 512GB NVMe 
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time.

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 737
  • nothing is personal
Re: My Music Editor
« Reply #81 on: July 18, 2021, 20:43:40 »
I think this site is gone forever.. But its not :)
I was willing to pay for it to remain..

Anyway.. back to business.
Im working now on Moving the cursor.. and playing the samples from the middle and so on

Guys please forgive me if I dont replay to all the posts you posted..
Its too much of an overload for me.
I prefer to spend time going forward when things are working..

So, for now Ill move on. But I will reread everything Later
I would be glad to clean all this post because it was one big mess, but thats not in my hands.

I want to know if its possible to Make sound Effects in Real time Like Echo..
and so on..

Question: Why in the SaveSample Function you have this 40 Addings? FileStream.WriteInt(MySample.Sample.length + 40)


« Last Edit: July 18, 2021, 20:52:26 by Hardcoal »
...

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3227
  • elgol
Re: My Music Editor
« Reply #82 on: July 18, 2021, 21:53:23 »
It's very disappointing when new people come to a site and immediately start making assumptions about people, start making demands.

They've been here 5 minutes and so should try and understand some people leave because, well they have 'issues' and could have an argument in an empty room, rather than guessing why they left, and so tarnishing the good peeps here.

The arrogance here is off the scale.  We have been here sometime and know Adam's credentials in the sound arena and coding prowess.
« Last Edit: July 18, 2021, 21:55:58 by Steve Elliott »
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 737
  • nothing is personal
Re: My Music Editor
« Reply #83 on: July 18, 2021, 22:30:45 »
Steve Elliott
I totally Agree with you..
and to criticize someone of the scale of IWasAdam is even more ridicules

I expect from such a site of this level to display really polite behavior towards one other..

I totally love and value the people here..
everything that Is done here comes from pure will to help, one other.


 
...

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 737
  • nothing is personal
Re: My Music Editor
« Reply #84 on: July 22, 2021, 00:04:30 »
Ok Im back after some break..  (I did some other programming missions)

Hope no one is Mad over me from whatever reason..

Anyway I did PlaySampleFromMIddle function and here it is..
Please tell me if i did it right

Code: [Select]
Method PlaySampleSection(MySample:MySample_Type, StartPointInSecs:Float = 0, LengthInSecs:Float = 0)
Local LengthInBytes, StartPointInBytes

If LengthInSecs <= 0 Then Return

LengthInBytes = LengthInSecs * SAMPLE_RATE * 4
StartPointInBytes = StartPointInSecs * SAMPLE_RATE * 4  'should be short

Local TempSample:TAudioSample = CreateAudioSample(LengthInBytes, mysample.Sample.hertz, mysample.Sample.format)
Local Counter
For Local I = StartPointInBytes To StartPointInBytes + LengthInBytes
TempSample.samples[Counter] = MySample.Sample.samples[I]
Counter = Counter + 1
Next

Local TS:TSound = LoadSound(TempSample)
PlaySound(TS)
End Method


I added a Demo For what I reached so far..
This Crap is Rather confusing I must Admit

https://drive.google.com/file/d/1jCpl70KQ9FNX3mn4olT4ePTHQJAbv5EL/view?usp=sharing
« Last Edit: July 22, 2021, 05:15:13 by Hardcoal »
...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2450
Re: My Music Editor
« Reply #85 on: July 22, 2021, 14:00:43 »
@Hardcoal
My advice is to take things at your own pace with audio - it's very low level stuff, pointers and bytes and all sorts of weird little things that make something work one day and then not work the next.

What you have done (so far) deserves respect - particularly as you are getting conflicting and sometimes unusual advice as to what to do and what to not do.

You also deserve kudos for sticking with your editor concepts, making them work and getting results - all of this is tedius and most people give up - so you are doing things right for you \o/


I know that I can come across 'snarky' at times. but time has taught me some of the 'tricks' that make programming simpler.

Some things are easy (showing a waveform)
Some things are more difficult (having variable loop points in a sample) (showing the current play position in a sample)
Some things can be really hard (realtime filters, lfos and envelopes)

but don't be put off there are ways around everything ;)

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 737
  • nothing is personal
Re: My Music Editor
« Reply #86 on: July 22, 2021, 17:51:03 »
Thanks Adam very kind words
All Im doing including my game editor I never gave up on anything..
I use stuff I made from all the projects and also always planning to continue everything I started..
I building projects In a way that it is easy to Drop them and return to them rather quickly and understand what's going on their.

About this music Editor.. I do Hold Great respect to anyone who put of from his time to help me..
So ill never complain and mention anyone who helped me in Credits And If I made money out of something Ill also wont forget people who helped me.
Im doing things on my own pace and mental state.
Ye Im pleased with my achievements and midi master especially helped me so much, I owe him a lot.

(My mood does not always allow me to be stable at one thing)

What Im doing is Tools..
Tools that I can later Clone from one place to another ..
And see what I can make of it.

I planning on small projects , not like before when I tried to take over the world..

Like an Audio Recorder..
and those sort of things.

Im continuing on this sample editing manipulation up to a point.
than ill drop it and move on to other thing

Hope ill keep getting help here.
cause its for the benefit of all




« Last Edit: July 22, 2021, 18:29:37 by Hardcoal »
...

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 737
  • nothing is personal
Re: My Music Editor
« Reply #87 on: July 22, 2021, 19:53:50 »
What is the best way to Free a TaudioSample..?
And Reconstruct it

Cheers
...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2450
Re: My Music Editor
« Reply #88 on: July 22, 2021, 20:14:11 »
I’m not at my machine to check things. But usually (if it’s a ng class) you just set it to null

Class = null

This will set the internal garbage collector to automatically free thing for you. Derron can probably give you the exact details…

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2450
Re: My Music Editor
« Reply #89 on: July 23, 2021, 07:53:05 »
No problem.

The TSample (PlaySampleFromMIddle function) - without running it looks generally right.

my general process is similar:
1. create new sample of the size you need
2. copy, modify (etc) from the old sample to the new sample

:)


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal