Recent

Author Topic: The sound of the universe;)  (Read 11684 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #60 on: November 09, 2020, 06:06:06 pm »

Yes and all that to say that I seriously think to add your Wave-Type (that you have done in ALSA_sound) in uos.
Till now uos_AddFromSynth() generate only sine-waves (not square nor teeth).

Hi Fred!

Wavetypes are no secret. Add my code to uos.
Even Wikipedias knows about them : https://en.wikipedia.org/wiki/Square_wave
The article is poor but the diagram of waveforms is nice.

And save time: don't try to create triangle waves.
They sound nearly like sinus waves.
As one can see already in the diagramm.

Winni


Hello Winni.

I did add the "WaveType" parameter  and the square wave type.

Also was added the "NbHarmonic" parameter that decides how many harmonics have to be produced.
Code: Pascal  [Select][+][-]
  1. function uos_AddFromSynth(PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: integer;
  2.  FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration : cint32; NbHarmonic: cint32;
  3.  OutputIndex: cint32;  SampleFormat: cint32 ; SampleRate: cint32 ; FramesCount : cint32): cint32;
  4.  
  5.       // Add a input from Synthesizer with custom parameters
  6.  
  7.       // Channels : default : -1 (2) (1 = mono, 2 = stereo)
  8.       // WaveTypeL : default : -1 (0) (0 = sine-wave 1 = square-wave, left channel used for mono and stereo)
  9.       // WaveTypeR : default : -1 (0) (0 = sine-wave 1 = square-wave, right channel used for stereo, ignored for mono)
  10.       // FrequencyL : default : -1 (440 htz) (Left frequency, used for mono)
  11.       // FrequencyR : default : -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
  12.       // VolumeL : default : -1 (= 1) (from 0 to 1) => volume left
  13.       // VolumeR : default : -1 (= 1) (from 0 to 1) => volume rigth (ignored for mono)
  14.       // Duration : default :  -1 (= 1000)  => duration in msec (0 = endless)
  15.       // NbHarmonic : default :  -1 (= 0) Number of Harmonic (0 to 5)
  16.       // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to a existing   OutputIndex  (if multi-output then OutName = name of each output separeted by ';')
  17.       // SampleFormat : default : -1 (0: Float32) (0: Float32, 1:Int32, 2:Int16)
  18.       // SampleRate : delault : -1 (44100)
  19.       // FramesCount : -1 default : 1024
  20.  
  21.    procedure uos_InputSetSynth(PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: integer;
  22.          FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration: cint32;
  23.          NbHarmonic: cint32; Enable: boolean);
  24.  
  25.        // To set live the parameters.


But about the shape of sine-wave, does somebody have a idea how to produce "Modulated Frequencies" like used for the great DX7 Yamaha synthesizer?
https://en.wikipedia.org/wiki/Frequency_modulation

It is a sine-wave customized but how to traduce this in a Pascal math formula?

Thanks.

Fre;D
« Last Edit: November 09, 2020, 06:21:59 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: The sound of the universe;)
« Reply #61 on: November 09, 2020, 09:15:59 pm »
Hi Fred!

Thanx for the cheers!

I am just busy - therefore the short way

You take the frequency - to make it simple only mono.

Now you change the frequency with the sinus value of the modulating frequency:

Code: Pascal  [Select][+][-]
  1. Frequency := sinus (ModulatingFreq) *0.X * Frequency +Frequency;
  2.  

The value 0.X is the influence of the final frequency. If you select it > 1 then the modulating frequency has more weight than the base frequency.

I don't know the code of uos (shame on me).
So the tip for the other way round:

As

Code: Pascal  [Select][+][-]
  1. WaveLength := 1/Frequency;

If you squeeze the wavelength you increase the frequenvy.
And vice versa.

Keep on hackin'

Winni

PS.: easy trick for another sound effect - also used by blaazen:
If you make a small difference between the 2 stereo cannels,
you get a little bit of flanger:

Code: Pascal  [Select][+][-]
  1. LeftFreq := RightFreq * 1.01;




 
« Last Edit: November 09, 2020, 09:21:06 pm by winni »

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #62 on: November 09, 2020, 09:31:19 pm »
Hello Winni.

Many thanks for your light, I will deeply study it.

Quote
I don't know the code of uos.

Huh, lot of the code comes from Lazarus forum help.
uos uses Portaudio for dealing with devices.

For example, the uos synthesizer part was highly inspired from Blaazen Synthe code.
I am busy to re-write it with all the new tips from last topics that we had together.

Fre;D


 

I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

jamie

  • Hero Member
  • *****
  • Posts: 7601
Re: The sound of the universe;)
« Reply #63 on: November 10, 2020, 12:34:53 am »
Well, I was going to attached the project I made using the ACS audio controls but its too large for that.
 
 I'll comeback when I can shrink it, I'll remove the preloaded image..

Back.. Much smaller now..

You need to load some images from space...
« Last Edit: November 10, 2020, 12:38:05 am by jamie »
The only true wisdom is knowing you know nothing

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #64 on: November 10, 2020, 01:30:36 am »
@ Winni.

About the shape of the LookupTable, from the Blaazen demo.

To define the shape of the wave, the LookupTable (array of 1024 float) is filled with FillLookupTable.

So, at the moment only a sine (or square) wave can be designed.

If I understand ok, a modulated frequency is a kind of sine-wave no regular.

Here the code of Blaazen:

Code: Pascal  [Select][+][-]
  1.    l:=1024;
  2.   nPI_l:=2*PI/l;
  3.  
  4. for i:=0 to l-1 do  
  5. begin
  6.    LookupTable[i]:=sin(i*nPI_l); // Could this not be more exotic ?
  7. end;

Will it work to use a LookupTable for modulated frequency?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #65 on: November 10, 2020, 01:48:11 am »
@ jamie

I did try your demo but sadly I fail to install ACS from OPM.
« Last Edit: November 10, 2020, 01:53:28 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

jamie

  • Hero Member
  • *****
  • Posts: 7601
Re: The sound of the universe;)
« Reply #66 on: November 10, 2020, 02:15:38 am »
I am sorry to hear that..

There two separated packages in there and I believe I installed them one at a time..

The first one, and then the lib one..

I used the trunk to install the package from the online packager.. I am also on windows.
The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: The sound of the universe;)
« Reply #67 on: November 10, 2020, 02:19:51 am »
Hi Fred!

There are two different ways of generating the envelope of the waves.

What we did was creating a wave with a lot of overtones:

The saw tooth contains all of them and the square wave contains all odd overtones.
Now you can filter out the passive way parts of the envelope:
You can use HighPass and LowPass filters to "throw away" parts of the sound.
Combined they are BandPass filters which only let a part i the middle through:

A hard Bandpass  freq between only 300 and 800 Hz sounds like an old telephon or like a 60ies  transistor radio.
A "moving" bandpath is the wahwah pedal. Loved by a lot of guitar players except George Harrison ("Don't need a WahWah" - not such a big hit). With the pedal you move the BandPath up and down.

An Equalizer is an array of BandPath - one slider for evey frequency range.

Opposite is the Synthesizer.  Every Sound - even the strangest - is a stack of sinus frequencies.  If you can analyse every sound down to a lot of sinus waves, you can do it the other way round: synthesize your sound with natural or ugly overtones.

So blaazen's lookup table is definede for sinus waves. Later he creates all or only odd overtones. If in the

procedure TFrm_Test.FillLookupTable(AHarmonics: Integer);

He fills - if wanted - up to 20 and some harmonics = overtones.
The are put in the next elements of the lookuptable.  So he create - he synthesizes - in the end a saw thooth wave with all harmonics. And somewhere is a check box, if only odd harmonics are used: He creates a square wave.

So the sythesizing is bottom up  and the filtering is top down.
But for the filtering you got only one tone with his harmonics.
You are always fixed to that group of frequencies - even if a WahWah does not make you think so.

But with a synthesizer you can mix  a second or third frequency into your sound - with a second lookup table. You can put unharmonic erruptions on your sound or do a frequency fading. You know better about the DC7 and the following 40 years of synthesizers. I am a guitar man.

So much about the moving from the equalizer to the synthesizer in all those years.

Winni
« Last Edit: November 10, 2020, 02:24:20 am by winni »

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #68 on: November 10, 2020, 02:42:09 am »
@ jamie.

Ha, ok, you are on Windows.

I am on Linux and, like always, I fail to make ACS work.
I did re-try tonight but without luck (and dont have to much energy).

I dont have a Windows machine to try now, sorry.

@ Winni.

Very clear, as usual.

So to resume about the TFrm_Test.FillLookupTable(AHarmonics: Integer),
with the "extended" parameters (odd harmonics, ...) is is already a sine "moduled", and working on the formula is "Modulation of Frequency".

OK, let's tune it.

Fre;D

PS: I am more strings than keyboard.


I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: The sound of the universe;)
« Reply #69 on: November 10, 2020, 02:45:25 am »
hello,
@ jamie
I did try your demo but sadly I fail to install ACS from OPM.
i have no problem to install ACS from OPM  on windows 10 with Lazarus 2.0.10  fpc 3.2      32 bits.
i have seen that in the file acs_cdrom :
Quote
{ Dummy file, not supported on Win64 }   

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

jamie

  • Hero Member
  • *****
  • Posts: 7601
Re: The sound of the universe;)
« Reply #70 on: November 10, 2020, 02:47:55 am »
I have it working on Windows 64.

I don't know about the CDRom support, I didn't try any of that.
The only true wisdom is knowing you know nothing

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: The sound of the universe;)
« Reply #71 on: November 10, 2020, 02:53:24 am »
@ jamie.
Ha, ok, you are on Windows.
I am on Linux and, like always, I fail to make ACS work.
try to disable acs_cdrom from the package, i have seen that in the acs_cdrom.inc :
Quote
{
CD-ROM for Windows

This file is a part of Audio Components Suite.
All rights reserved. See the license file for more details.

Copyright (c) 2002-2009, Andrei Borovsky, anb@symmetrica.net
Copyright (c) 2005-2006  Christian Ulrich, mail@z0m3ie.de
Copyright (c) 2014-2015  Sergey Bodrov, serbod@gmail.com
}         
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #72 on: November 10, 2020, 02:56:24 am »
@ jamie.
Ha, ok, you are on Windows.
I am on Linux and, like always, I fail to make ACS work.
try to disable acs_cdrom from the package, i have seen that in the acs_cdrom.inc :
Quote
{
CD-ROM for Windows

This file is a part of Audio Components Suite.
All rights reserved. See the license file for more details.

Copyright (c) 2002-2009, Andrei Borovsky, anb@symmetrica.net
Copyright (c) 2005-2006  Christian Ulrich, mail@z0m3ie.de
Copyright (c) 2014-2015  Sergey Bodrov, serbod@gmail.com
}         

Sorry but I dont know well how to work with Lazarus package.
How do you do to disable acs_cdrom form package.

Did you try ACS on Linux 64 bit?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

jamie

  • Hero Member
  • *****
  • Posts: 7601
Re: The sound of the universe;)
« Reply #73 on: November 10, 2020, 03:04:53 am »
He is talking about opening the package files which allows you to edit the files and recompile them.

you can do that without installing them in the IDE first.
The only true wisdom is knowing you know nothing

Fred vS

  • Hero Member
  • *****
  • Posts: 3826
    • StrumPract is the musicians best friend
Re: The sound of the universe;)
« Reply #74 on: November 10, 2020, 03:09:13 am »
He is talking about opening the package files which allows you to edit the files and recompile them.

you can do that without installing them in the IDE first.

Hello.

Sorry I give up, there are too much errors while trying to compile ACS on Linux, even without cdrom.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018