[FFmpeg-devel] [PATCH v6]libavfilter/asrc_fluidsynthmusic.c : generate algorithmic music

2020-09-06 Thread Ashutosh Pradhan
Generate algorithmic music using riffs, lindenmayer systems, cellular automaton 
and rhythm algorithms.

 Changelog  |1 +
 configure  |4 +
 doc/filters.texi   |  146 
 libavfilter/Makefile   |1 +
 libavfilter/allfilters.c   |1 +
 libavfilter/asrc_fluidsynthmusic.c | 1344 
 libavfilter/notedef.h  |  269 
 libavfilter/version.h  |2 +-
 8 files changed, 1767 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 0108f8f1a8..fb60ea098f 100644
--- a/Changelog
+++ b/Changelog
@@ -89,6 +89,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
+- fluidsynthmusic filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 8de1afcb99..cc4b3f8bdc 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynthmusic 
source filter [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1774,6 +1775,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3493,6 +3495,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+fluidsynthmusic_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6336,6 +6339,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index d8cd45066a..6c5ec217d1 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,152 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section fluidsynthmusic
+
+Generate nice listenable algorithmic music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item nb_samples
+Set the number of samples per each output frame. Default is 1024.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for ubuntu linux). Recommended to 
+use the FluidR3_GM general midi soundfont file.
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press between 0 to 127. Default value is 80.
+
+@item p_velocity
+Specify the velocity of key press for percussion track between 0 to 127. 
+Default value is 80.
+
+@item bpm
+Specify the beats per minute. Default is 80.
+
+@item seed
+Specify the seed for random number generator, must be an integer included 
between 0 and
+UINT32_MAX. If not specified, or if explicitly set to -1, the filter will use 
a random seed.
+
+@item algo
+Specify the algorithm type. Available options are riffs, lsystem, 
ca(cellular_automaton)
+and rhythm. Default is ca.
+
+@item instrument
+Specify the instrument for riffs and Lindenmayer system. Available instruments 
are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Acoustic-Grand.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Shuffle.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item scale
+Set the scale for Lindenmayer system and cellular automaton. Specify as root 
note_scale type.
+Specify scale types as major, n_minor for natural minor, m_minor for melodic 
minor, h

Re: [FFmpeg-devel] [PATCH v5]libavfilter/asrc_fluidsynthmusic.c : generate algorithmic music

2020-09-04 Thread Ashutosh Pradhan
On Fri, Sep 4, 2020 at 6:08 PM Paul B Mahol  wrote:

> On 8/25/20, Ashutosh Pradhan  wrote:
> > Generate algorithmic music using riffs, lindenmayer systems, cellular
> > automaton and rhythm algorithms.
> >
> >  Changelog  |1 +
> >  configure  |4 +
> >  doc/filters.texi   |  146 
> >  libavfilter/Makefile   |1 +
> >  libavfilter/allfilters.c   |1 +
> >  libavfilter/asrc_fluidsynthmusic.c | 1344
> > 
> >  libavfilter/notedef.h  |  269 
> >  libavfilter/version.h  |2 +-
> >  8 files changed, 1767 insertions(+), 1 deletion(-)
> >
> > diff --git a/Changelog b/Changelog
> > index 0108f8f1a8..fb60ea098f 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -89,6 +89,7 @@ version 4.3:
> >  - PFM decoder
> >  - dblur video filter
> >  - Real War KVAG muxer
> > +- fluidsynthmusic filter
> >
>
> This crashes for high gen option set.
>
For the L system, the strings nextgen and prevgen are computed for every
generation until the final generation is reached. For very high values of
gen(number of generations), it takes significant time to compute the
nextgen.
But as given in the reference, higher generations say beyond 10 repeats the
sequence. I think I should set the maximum limit of gen to a more practical
value of around 10 to 20.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v5]libavfilter/asrc_fluidsynthmusic.c : generate algorithmic music

2020-08-25 Thread Ashutosh Pradhan
Generate algorithmic music using riffs, lindenmayer systems, cellular automaton 
and rhythm algorithms.

 Changelog  |1 +
 configure  |4 +
 doc/filters.texi   |  146 
 libavfilter/Makefile   |1 +
 libavfilter/allfilters.c   |1 +
 libavfilter/asrc_fluidsynthmusic.c | 1344 
 libavfilter/notedef.h  |  269 
 libavfilter/version.h  |2 +-
 8 files changed, 1767 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 0108f8f1a8..fb60ea098f 100644
--- a/Changelog
+++ b/Changelog
@@ -89,6 +89,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
+- fluidsynthmusic filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 8de1afcb99..cc4b3f8bdc 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynthmusic 
source filter [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1774,6 +1775,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3493,6 +3495,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+fluidsynthmusic_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6336,6 +6339,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index d8cd45066a..7754f72dfc 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,152 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section fluidsynthmusic
+
+Generate nice listenable algorithmic music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item nb_samples
+Set the number of samples per each output frame. Default is 1024.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for ubuntu linux). Recommended to 
+use the FluidR3_GM general midi soundfont file.
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press between 0 to 127. Default value is 80.
+
+@item p_velocity
+Specify the velocity of key press for percussion track between 0 to 127. 
+Default value is 80.
+
+@item bpm
+Specify the beats per minute. Default is 80.
+
+@item seed
+Specify the seed for random number generator, must be an integer included 
between 0 and
+UINT32_MAX. If not specified, or if explicitly set to -1, the filter will use 
a random seed.
+
+@item algo
+Specify the algorithm type. Available options are riffs, lsystem, 
ca(cellular_automaton)
+and rhythm. Default is ca.
+
+@item instrument
+Specify the instrument for riffs and Lindenmayer system. Available instruments 
are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Acoustic-Grand.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Shuffle.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item scale
+Set the scale for Lindenmayer system and cellular automaton. Specify as root 
note_scale type.
+Specify scale types as major, n_minor for natural minor, m_minor for melodic 
minor, h

Re: [FFmpeg-devel] [PATCH v4]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-20 Thread Ashutosh Pradhan
On Thu, Aug 20, 2020 at 7:58 PM Nicolas George  wrote:

> Ashutosh Pradhan (12020-08-20):
> > But, for that, we need to store the frequency information of each
> > instrument hence would be the same as reading SoundFont files, I think.
> > Also, the duration output would be the same as a note-on and note-off
> event.
>
> Les me rephrase the question: how hard would it be to use another
> synthesizer library with a slightly different API?
> Not much I think.
> Regards,
>
> --
>   Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-20 Thread Ashutosh Pradhan
On Thu, Aug 20, 2020 at 1:10 PM Nicolas George  wrote:

> Ashutosh Pradhan (12020-08-20):
> > I think it would be a bit difficult considering we have to read SoundFont
> > files, read and write midi events, code for the sequencer, synth, etc.
>
> I mean precisely without doing all that. Your code produces notes at
> certain times: can they be made available, their pitch and duration,
> directly?
>
But, for that, we need to store the frequency information of each
instrument hence would be the same as reading SoundFont files, I think.
Also, the duration output would be the same as a note-on and note-off event.

> Regards,
>
> --
>   Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-19 Thread Ashutosh Pradhan
On Wed, Aug 19, 2020 at 6:12 PM Nicolas George  wrote:

> Ashutosh Pradhan (12020-08-18):
> > Generate algorithmic music using riffs, lindenmayer systems, cellular
> automaton and rhythm algorithms.
> > Fixed the error that was causing segmentation fault in the previous
> patch.
>
> Thanks. (But this last sentence should be below the --- in the mail, not
> in the commit message.)
>
> I also notice that the output with the options given in example is much
> more interesting than the default, and can justify the usefulness of the
> filter. Good job!
>
> Two points:
>
> - Since it uses fluidsynth, the filter would probably better be called
>   like that, especially since it does not produces tones but almost-real
>   instrument sounds. Let us keep "atone" for a 100% internal
>   implementation.
>
> - I would really appreciate an answer to this question:
>
> >> Since you know the API best, could you say in a few words how hard it
> >> would be to get rid of fluidsynth and use an internal synthesizer
> >> instead?
>
I think it would be a bit difficult considering we have to read SoundFont
files, read and write midi events, code for the sequencer, synth, etc.

>
> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v4]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-18 Thread Ashutosh Pradhan
Generate algorithmic music using riffs, lindenmayer systems, cellular automaton 
and rhythm algorithms.
Fixed the error that was causing segmentation fault in the previous patch.

 Changelog|1 +
 configure|4 +
 doc/filters.texi |  146 +
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/asrc_atone.c | 1343 ++
 libavfilter/notedef.h|  269 ++
 libavfilter/version.h|2 +-
 8 files changed, 1766 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 0108f8f1a8..0d759b7eb7 100644
--- a/Changelog
+++ b/Changelog
@@ -89,6 +89,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 8de1afcb99..783bae8a03 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for atone source 
filter [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1774,6 +1775,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3493,6 +3495,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6336,6 +6339,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index d8cd45066a..f21b30ca47 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,152 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate nice listenable algorithmic music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item nb_samples
+Set the number of samples per each output frame. Default is 1024.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for ubuntu linux). Recommended to 
+use the FluidR3_GM general midi soundfont file.
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press between 0 to 127. Default value is 80.
+
+@item p_velocity
+Specify the velocity of key press for percussion track between 0 to 127. 
+Default value is 80.
+
+@item bpm
+Specify the beats per minute. Default is 80.
+
+@item seed
+Specify the seed for random number generator, must be an integer included 
between 0 and
+UINT32_MAX. If not specified, or if explicitly set to -1, the filter will use 
a random seed.
+
+@item algo
+Specify the algorithm type. Available options are riffs, lsystem, 
ca(cellular_automaton)
+and rhythm. Default is ca.
+
+@item instrument
+Specify the instrument for riffs and Lindenmayer system. Available instruments 
are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Acoustic-Grand.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Metronome.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item scale
+Set the scale for Lindenmayer system and cellular automaton. Specify as root 
note_scale type.
+Specify scale types as major, n_minor for natural minor, m_minor for melodic 
minor, h_minor 
+as harmonic minor, p_

Re: [FFmpeg-devel] [PATCH v2]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-17 Thread Ashutosh Pradhan
On Mon, Aug 17, 2020 at 4:37 PM Nicolas George  wrote:

> Ashutosh Pradhan (12020-08-17):
> > I have provided the sample for  $ ./ffplay -f lavfi -i atone
> > in the folder
> >
> https://drive.google.com/drive/folders/1manne188m5T-7wWZb7ZJBLZasLmsX05i?usp=sharing
>
> Thank you. That was more helpful.
>
> Honestly, this is not "nice", it is just boring. Which is not your
> fault: you could not hope to achieve in a summer what eludes years-long
> PhD theses in musicology and artificial intelligence. The project was as
> it is, and you seem to have more or less succeeded to implement it.
> Variations of rhythm would have been nice, though.
>
> But the fact remains that this is of no practical use. It is of no use
> to just listen to and enjoy, and since it uses an external library it is
> of no use for testing. (This project seems to be based on an old
> proposal of mine, with the goal to have a varied and somewhat realistic
> source for audio testing. But testing requires we trust the source is
> bit-exact.)
>
> Since you know the API best, could you say in a few words how hard it
> would be to get rid of fluidsynth and use an internal synthesizer
> instead?
>
> But in any case, your most urgent matter at hand is this:
>
> > > $ ./ffmpeg_g -lavfi atone /tmp/atone.ogg
> ...
> > > zsh: segmentation fault  ./ffmpeg_g -lavfi atone /tmp/atone.ogg
>
I am unable to understand the cause of this error. Are you using sdl2 as
the audio driver?

>
> Because we definitely cannot accept a patch that segfaults like that.
>
> Regards,
>
> --
>   Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-17 Thread Ashutosh Pradhan
On Mon, Aug 17, 2020 at 3:38 PM Nicolas George  wrote:

> Paul B Mahol (12020-08-17):
> > Yes could apply the patch and compile it and run it.
>
> Yes, requiring everybody who wants to make an opinion to do that, what
> an excellent choice compared to uploading a sample somewhere.
>
 Hi
I have provided the sample for  $ ./ffplay -f lavfi -i atone
in the folder
https://drive.google.com/drive/folders/1manne188m5T-7wWZb7ZJBLZasLmsX05i?usp=sharing

Anyway:
>
> $ ./ffmpeg_g -lavfi atone -f alsa default -
> ffmpeg version N-98748-g4add66308a Copyright (c) 2000-2020 the FFmpeg
> developers
>   built with gcc 10 (Debian 10.2.0-5)
>   configuration: --enable-shared --disable-static --enable-gpl
> --enable-libx264 --enable-libopus --enable-libass --enable-libfreetype
> --enable-opengl --enable-libfluidsynth --assert-level=2
>   libavutil  56. 58.100 / 56. 58.100
>   libavcodec 58.100.100 / 58.100.100
>   libavformat58. 51.100 / 58. 51.100
>   libavdevice58. 11.101 / 58. 11.101
>   libavfilter 7. 88.100 /  7. 88.100
>   libswscale  5.  8.100 /  5.  8.100
>   libswresample   3.  8.100 /  3.  8.100
>   libpostproc55.  8.100 / 55.  8.100
> fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be
> usable
> zsh: segmentation fault  ./ffmpeg_g -lavfi atone -f alsa default -
>
> $ ./ffmpeg_g -lavfi atone /tmp/atone.ogg
> ffmpeg version N-98748-g4add66308a Copyright (c) 2000-2020 the FFmpeg
> developers
>   built with gcc 10 (Debian 10.2.0-5)
>   configuration: --enable-shared --disable-static --enable-gpl
> --enable-libx264 --enable-libopus --enable-libass --enable-libfreetype
> --enable-opengl --enable-libfluidsynth --assert-level=2
>   libavutil  56. 58.100 / 56. 58.100
>   libavcodec 58.100.100 / 58.100.100
>   libavformat58. 51.100 / 58. 51.100
>   libavdevice58. 11.101 / 58. 11.101
>   libavfilter 7. 88.100 /  7. 88.100
>   libswscale  5.  8.100 /  5.  8.100
>   libswresample   3.  8.100 /  3.  8.100
>   libpostproc55.  8.100 / 55.  8.100
> fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be
> usable
> zsh: segmentation fault  ./ffmpeg_g -lavfi atone /tmp/atone.ogg
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-17 Thread Ashutosh Pradhan
On Mon, Aug 17, 2020 at 3:05 PM Paul B Mahol  wrote:

> On 8/17/20, Ashutosh Pradhan  wrote:
> > Generate algorithmic music using riffs, lindenmayer systems, cellular
> > automaton and rhythm algorithms.
> >
>
> Do you allow to change seed of lfg generator or seed is always same?
> Idea is to always have same output for same seed parameter.
> And also to be able to use different seed when initializing lfg.
>
I have initialized the lfg generator with a random seed.
Should I take seed as an option?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-17 Thread Ashutosh Pradhan
Generate algorithmic music using riffs, lindenmayer systems, cellular automaton 
and rhythm algorithms.

 Changelog|1 +
 configure|4 +
 doc/filters.texi |  141 +
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/asrc_atone.c | 1336 ++
 libavfilter/notedef.h|  278 ++
 libavfilter/version.h|2 +-
 8 files changed, 1763 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 0108f8f1a8..0d759b7eb7 100644
--- a/Changelog
+++ b/Changelog
@@ -89,6 +89,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 8de1afcb99..783bae8a03 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for atone source 
filter [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1774,6 +1775,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3493,6 +3495,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6336,6 +6339,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index d8cd45066a..eacb502530 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,147 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate nice listenable algorithmic music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item nb_samples
+Set the number of samples per each output frame. Default is 1024.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for ubuntu linux). Recommended to 
+use the FluidR3_GM general midi soundfont file.
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item p_velocity
+Specify the velocity of key press for percussion track. Default value is 80.
+
+@item bpm
+Specify the beats per minute. Default is 80.
+
+@item algo
+Specify the algorithm type. Available options are riffs, lsystem, 
ca(cellular_automaton)
+and rhythm. Default is ca.
+
+@item instrument
+Specify the instrument for riffs and Lindenmayer system. Available instruments 
are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Acoustic-Grand.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Metronome.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item scale
+Set the scale for Lindenmayer system and cellular automaton. Specify as root 
note_scale type.
+Specify scale types as major, n_minor for natural minor, m_minor for melodic 
minor, h_minor 
+as harmonic minor, p_major for pentatonic major, p_minor for pentatonic minor 
and blues for 
+blues scale. The root note is specified as C or Cs or Db for C or C sharp or D 
flat respectively.
+So scale specified as C_n_minor, Cs_p_major, etc. Default is C_major.
+
+@item height
+Set the height for mapping of scale for cellular 

[FFmpeg-devel] [PATCH v2]libavfilter/asrc_atone.c : generate algorithmic music

2020-08-12 Thread Ashutosh Pradhan
Generate algorithmic music using riffs, lindenmayer systems, cellular automaton 
and rythm algorithms. 

 Changelog|1 +
 configure|4 +
 doc/filters.texi |  141 +
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/asrc_atone.c | 1324 ++
 libavfilter/notedef.h|  278 ++
 libavfilter/version.h|2 +-
 8 files changed, 1751 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 0108f8f1a8..0d759b7eb7 100644
--- a/Changelog
+++ b/Changelog
@@ -89,6 +89,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 8de1afcb99..783bae8a03 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for atone source 
filter [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1774,6 +1775,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3493,6 +3495,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6336,6 +6339,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index d8cd45066a..0e809977b1 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,147 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate algorithmic music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item nb_samples
+Set the number of samples per each output frame. Default is 1024.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for ubuntu linux). Recommended to 
+use the FluidR3_GM general midi soundfont file.
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item p_velocity
+Specify the velocity of key press for percussion track. Default value is 80.
+
+@item bpm
+Specify the beats per minute. Default is 80.
+
+@item algo
+Specify the algorithm type. Available options are riffs, lsystem, 
ca(cellular_automaton)
+and rythm. Default is ca.
+
+@item instrument
+Specify the instrument for riffs and Lindenmayer system. Available instruments 
are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Acoustic-Grand.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Metronome.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item scale
+Set the scale for Lindenmayer system and cellular automaton. Specify as root 
note_scale type.
+Specify scale types as major, n_minor for natural minor, m_minor for melodic 
minor, h_minor 
+as harmonic minor, p_major for pentatonic major, p_minor for pentatonic minor 
and blues for 
+blues scale. The root note is specified as C or Cs or Db for C or C sharp or D 
flat respectively.
+So scale specified as C_n_minor, Cs_p_major, etc. Default is C_major.
+
+@item height
+Set the height for mapping of scale for cellular automaton and Lin

Re: [FFmpeg-devel] [PATCH]libavfilter/asrc_atone.c : generate algorithmic music

2020-06-30 Thread Ashutosh Pradhan
On Tue, Jun 30, 2020 at 8:40 PM Thilo Borgmann 
wrote:

> Am 30.06.20 um 16:09 schrieb Ashutosh Pradhan:
> > On Mon, Jun 29, 2020 at 6:53 PM Moritz Barsnick 
> wrote:
> >
> >> On Thu, Jun 25, 2020 at 21:15:06 +0530, Ashutosh Pradhan wrote:
> >>> Generate algorithmic riff music. Changed to activate api.
> >>
> >> This commit doesn't change to activate API, as it introduces this
> >> filter. So that sentence doesn't belong here.
> >>
> >>>  - Real War KVAG muxer
> >>> -
> >>> +- atone filter
> >>
> >> Don't remove the empty line.
> >>
> >>>--enable-libfliteenable flite (voice synthesis) support via
> >> libflite [no]
> >>> +  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth
> >> [no]
> >>
> >> "for fluidsynth"?. Perhaps "for atone source".
> >>
> > Will change to above.
> >
> >>
> >>>  atempo_filter_select="rdft"
> >>> +atone_filter_deps="libfluidsynth"
> >>
> >>> +@item sfont
> >>> +Specify the location of soundfont file. Default value is
> >>> +"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
> >>
> >> For Linux - and elsewhere?
> >> It will be the same path on all Unixes, but meaningless under Windows,
> >> I guess.
> >>
> > Yes.
> > Windows doesn't have the recommended Fluid_R3 General Midi SoundFont
> file.
> > So one has to enter the path every time.
> >
> >>
> >>> +++ b/libavfilter/Makefile
> >>> @@ -152,6 +152,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  +=
> >> asrc_flite.o
> >>>  OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
> >>>  OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
> >>>  OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
> >>> +OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
> >>
> >> I believe the audio sources are meant to be sorted alphabetically (by
> >> CONFIG_*).
> >>
> >>> --- a/libavfilter/allfilters.c
> >>> +++ b/libavfilter/allfilters.c
> >>> @@ -146,6 +146,7 @@ extern AVFilter ff_asrc_flite;
> >>>  extern AVFilter ff_asrc_hilbert;
> >>>  extern AVFilter ff_asrc_sinc;
> >>>  extern AVFilter ff_asrc_sine;
> >>> +extern AVFilter ff_asrc_atone;
> >>
> >> Same here.
> >>
> >>> +#include 
> >>
> >>> +s->beat_dur = 6/s->beats_pm;
> >>> +/*get change interval in frames/sec*/
> >>> +s->changerate = (4*s->beat_dur)*s->sample_rate/s->nb_samples;
> >>> +if (s->changerate<1.0)
> >>> +s->changerate = 1.0;
> >>
> >> Please leave single spaces around the operators such as '/', '*', '<'.
> >>
> >>> +s->numriffs = sizeof(riff)/(NPR* sizeof(int));
> >>
> >> Same here.
> >>
> >>> +for (int i = 0; i < s->numriffs*NPR ; i++)
> >>
> >> And here.
> >>
> >>> +if (s->framecount == INT_MAX)
> >>> +   s->framecount = 0;
> >>
> >> Indentation.
> >>
> >>> +for (int i = 0; i <
> >> sizeof(GM_instrument_list)/sizeof(GM_instrument_list[0]); i++)
> >>
> >> Use macro FF_ARRAY_ELEMS
> >>
> >>> +if (strcmp(GM_instrument_list[i], instrument) == 0)
> >>> +return i;
> >>> +
> >>> +return 0;
> >>> +}
> >>
> >> If this doesn't match any string, it returns 0. It also returns 0 if it
> >> matches "Acoustic-Grand". Is that correct? (In find_percussion_track(),
> >> you return i instead.)
> >>
> > I didn't want to output an error incase the instrument did not match. I
> > forgot to update 0 with the number of the default instrument. I will
> update
> > that.
>
> For that case, you might want to output a warning that the instrument
> could not be matched and the default instrument will be used instead.
>
I will change the code to implement this.

>
> >>
> >>> +static void schedule_noteon(int chan, short key, unsigned int ticks,
> >> int velocity, AtoneContext *s)
> >>> +{
> >>> +   fluid_event_t 

Re: [FFmpeg-devel] [PATCH]libavfilter/asrc_atone.c : generate algorithmic music

2020-06-30 Thread Ashutosh Pradhan
On Mon, Jun 29, 2020 at 6:53 PM Moritz Barsnick  wrote:

> On Thu, Jun 25, 2020 at 21:15:06 +0530, Ashutosh Pradhan wrote:
> > Generate algorithmic riff music. Changed to activate api.
>
> This commit doesn't change to activate API, as it introduces this
> filter. So that sentence doesn't belong here.
>
> >  - Real War KVAG muxer
> > -
> > +- atone filter
>
> Don't remove the empty line.
>
> >--enable-libfliteenable flite (voice synthesis) support via
> libflite [no]
> > +  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth
> [no]
>
> "for fluidsynth"?. Perhaps "for atone source".
>
Will change to above.

>
> >  atempo_filter_select="rdft"
> > +atone_filter_deps="libfluidsynth"
>
> > +@item sfont
> > +Specify the location of soundfont file. Default value is
> > +"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
>
> For Linux - and elsewhere?
> It will be the same path on all Unixes, but meaningless under Windows,
> I guess.
>
Yes.
Windows doesn't have the recommended Fluid_R3 General Midi SoundFont file.
So one has to enter the path every time.

>
> > +++ b/libavfilter/Makefile
> > @@ -152,6 +152,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  +=
> asrc_flite.o
> >  OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
> >  OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
> >  OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
> > +OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
>
> I believe the audio sources are meant to be sorted alphabetically (by
> CONFIG_*).
>
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -146,6 +146,7 @@ extern AVFilter ff_asrc_flite;
> >  extern AVFilter ff_asrc_hilbert;
> >  extern AVFilter ff_asrc_sinc;
> >  extern AVFilter ff_asrc_sine;
> > +extern AVFilter ff_asrc_atone;
>
> Same here.
>
> > +#include 
>
> > +s->beat_dur = 6/s->beats_pm;
> > +/*get change interval in frames/sec*/
> > +s->changerate = (4*s->beat_dur)*s->sample_rate/s->nb_samples;
> > +if (s->changerate<1.0)
> > +s->changerate = 1.0;
>
> Please leave single spaces around the operators such as '/', '*', '<'.
>
> > +s->numriffs = sizeof(riff)/(NPR* sizeof(int));
>
> Same here.
>
> > +for (int i = 0; i < s->numriffs*NPR ; i++)
>
> And here.
>
> > +if (s->framecount == INT_MAX)
> > +   s->framecount = 0;
>
> Indentation.
>
> > +for (int i = 0; i <
> sizeof(GM_instrument_list)/sizeof(GM_instrument_list[0]); i++)
>
> Use macro FF_ARRAY_ELEMS
>
> > +if (strcmp(GM_instrument_list[i], instrument) == 0)
> > +return i;
> > +
> > +return 0;
> > +}
>
> If this doesn't match any string, it returns 0. It also returns 0 if it
> matches "Acoustic-Grand". Is that correct? (In find_percussion_track(),
> you return i instead.)
>
I didn't want to output an error incase the instrument did not match. I
forgot to update 0 with the number of the default instrument. I will update
that.

>
> > +static void schedule_noteon(int chan, short key, unsigned int ticks,
> int velocity, AtoneContext *s)
> > +{
> > +   fluid_event_t *ev = new_fluid_event();
>
> Indentation.
>
> > +unsigned rand = av_lfg_get(&s->r)/2;
> [...]
> > +riff = rand%s->numriffs;
>
> Spaces around operators, please.
>
> > +if (3*i < numbars)
> > +return (100 - (90*i)/numbars);
> > +else if (3*i > 2*numbars)
> > +return (40 + (90*i)/numbars);
>
> Same here.
>
> > +/*Determine the pattern, tempo (to paly as 8th, 16th or 32nd notes) and
> add the riffs to sequencer
>
> "play"
>
> > +Refernce: http://peterlangston.com/Papers/amc.pdf */
>
> "Reference"
>
> > +AVFrame *frame;
> > +int  nb_samples;
>   ^^ two spaces, drop one.
>
> > +ret = ff_set_common_formats (ctx, formats);
>   ^ drop the space
>
> > +typedef struct
> > +{
>
> Bracket on the same line.
>
> > +Refernce: http://peterlangston.com/Papers/amc.pdf */
>
> "Reference".
>
>
> Regards,
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH]libavfilter/asrc_atone.c : generate algorithmic music

2020-06-25 Thread Ashutosh Pradhan
Generate algorithmic riff music. Changed to activate api.

 Changelog|   2 +-
 configure|   4 +
 doc/filters.texi |  56 ++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/asrc_atone.c | 474 +++
 libavfilter/notedef.h| 264 ++
 libavfilter/version.h|   2 +-
 8 files changed, 802 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index a60e7d2eb8..ec12027740 100644
--- a/Changelog
+++ b/Changelog
@@ -80,7 +80,7 @@ version 4.3:
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
-
+- atone filter
 
 version 4.2:
 - tpad filter
diff --git a/configure b/configure
index 7495f35faa..825e38a4b0 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1772,6 +1773,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3486,6 +3488,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6307,6 +6310,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 3c2dd2eb90..8733b52a2f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6128,6 +6128,62 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate algorithmic riff music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item percussion_velocity
+Specify the velocity of key press for percussion track. Default value is 127.
+
+@item bpm
+Specify the beats per minute. Default is 100.
+
+@item instrument
+Specify the instrument. Available instruments are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Trumpet.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Metronome.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item samples_per_frame
+Set the number of samples per each output frame. Default is 1024.
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Generate 10 seconds of riff music, with a key velocity of 100, instrument as 
Electric Guitar(jazz) 
+and percussion track as Jazz3:
+@example
+atone=d=10:v=100:sfont="example.sf2":instrument=Electric-Guitar-Jazz:percussion=Jazz3
+atone=duration=10:velocity=100:sfont="example.sf2":instrument=Electric-Guitar-Jazz:percussion=Jazz3
+@end example
+@end itemize
+
 @section hilbert
 
 Generate odd-tap Hilbert transform FIR coefficients.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540653..b0938830f2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -152,6 +152,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FIL

Re: [FFmpeg-devel] [PATCH][GSoC]audio filter - Generate algorithmic riff music

2020-06-14 Thread Ashutosh Pradhan
On Sun, Jun 14, 2020 at 10:34 PM Paul B Mahol  wrote:

> On 6/5/20, Ashutosh Pradhan  wrote:
> > diff --git a/Changelog b/Changelog
> > index 711c843b99..905b91b570 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -75,7 +75,7 @@ version :
> >  - PFM decoder
> >  - dblur video filter
> >  - Real War KVAG muxer
> > -
> > +- atone filter
> >
> >  version 4.2:
> >  - tpad filter
> > diff --git a/configure b/configure
> > index 8569a60bf8..954e35d62c 100755
> > --- a/configure
> > +++ b/configure
> > @@ -233,6 +233,7 @@ External library support:
> > and libraw1394 [no]
> >--enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
> >--enable-libfliteenable flite (voice synthesis) support via
> > libflite [no]
> > +  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth
> [no]
> >--enable-libfontconfig   enable libfontconfig, useful for drawtext
> filter
> > [no]
> >--enable-libfreetype enable libfreetype, needed for drawtext
> filter
> > [no]
> >--enable-libfribidi  enable libfribidi, improves drawtext filter
> [no]
> > @@ -1772,6 +1773,7 @@ EXTERNAL_LIBRARY_LIST="
> >  libdc1394
> >  libdrm
> >  libflite
> > +libfluidsynth
> >  libfontconfig
> >  libfreetype
> >  libfribidi
> > @@ -3484,6 +3486,7 @@ asr_filter_deps="pocketsphinx"
> >  ass_filter_deps="libass"
> >  atempo_filter_deps="avcodec"
> >  atempo_filter_select="rdft"
> > +atone_filter_deps="libfluidsynth"
> >  avgblur_opencl_filter_deps="opencl"
> >  avgblur_vulkan_filter_deps="vulkan libglslang"
> >  azmq_filter_deps="libzmq"
> > @@ -6304,6 +6307,7 @@ enabled libfdk_aac&& { check_pkg_config
> > libfdk_aac fdk-aac "fdk-aac/aace
> >   warn "using libfdk without
> pkg-config"; }
> > }
> >  flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb
> -lflite_cmu_us_kal
> > -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt
> -lflite_usenglish
> > -lflite_cmulex -lflite"
> >  enabled libflite  && require libflite "flite/flite.h" flite_init
> > $flite_extralibs
> > +enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth
> > "fluidsynth.h" fluid_log
> >  enabled fontconfig&& enable libfontconfig
> >  enabled libfontconfig && require_pkg_config libfontconfig fontconfig
> > "fontconfig/fontconfig.h" FcInit
> >  enabled libfreetype   && require_pkg_config libfreetype freetype2
> > "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index f76604c51e..fc34f76bee 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -6125,6 +6125,62 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
> >  @end example
> >  @end itemize
> >
> > +@section atone
> > +
> > +Generate algorithmic riff music.
> > +To compile filter configure ffmpeg with @code{--enable-libfluidsynth}
> > +
> > +The filter accepts the following options:
> > +
> > +@table @option
> > +@item sample_rate, r
> > +Specify the sample rate. Default value is 44100 Hz.
> > +
> > +@item sfont
> > +Specify the location of soundfont file. Default value is
> > +"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
> > +
> > +@item duration, d
> > +Specify the duration of the generated audio stream. Not specifying this
> > option
> > +results in playing tones for infinite length.
> > +
> > +@item velocity, v
> > +Specify the velocity of key press. Default value is 80.
> > +
> > +@item percussion_velocity
> > +Specify the velocity of key press for percussion track. Default value is
> > 127.
>
> Doesn't those two can be set per note, thus making it little weird to be
> global?
>
Yeah, it can be set per note but how should I make it(velocity/volume) a
user-defined input then?


>
> > +
> > +@item bpm
> > +Specify the beats per minute. Default is 100.
> > +
> > +@item instrument
> > +Specify the instrument. Available instruments are Acoustic-Grand,
> > +Bright-Acoustic, ... as defined in the General Midi specifications.
> Default
> > is Trumpet.
> > +
> > +@item percussion
> > +Specify the percussio

[FFmpeg-devel] [PATCH][GSoC]audio filter - Generate algorithmic riff music

2020-06-05 Thread Ashutosh Pradhan
diff --git a/Changelog b/Changelog
index 711c843b99..905b91b570 100644
--- a/Changelog
+++ b/Changelog
@@ -75,7 +75,7 @@ version :
 - PFM decoder
 - dblur video filter
 - Real War KVAG muxer
-
+- atone filter
 
 version 4.2:
 - tpad filter
diff --git a/configure b/configure
index 8569a60bf8..954e35d62c 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1772,6 +1773,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3484,6 +3486,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6304,6 +6307,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index f76604c51e..fc34f76bee 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6125,6 +6125,62 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate algorithmic riff music.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item percussion_velocity
+Specify the velocity of key press for percussion track. Default value is 127.
+
+@item bpm
+Specify the beats per minute. Default is 100.
+
+@item instrument
+Specify the instrument. Available instruments are Acoustic-Grand, 
+Bright-Acoustic, ... as defined in the General Midi specifications. Default is 
Trumpet.
+
+@item percussion
+Specify the percussion track for beats. Available options are Jazz1, 
+Jazz2, ..., Jazz6, Rock1...4, Shuffle, Metronome. Default is Metronome.
+
+@item numbars
+Set the number of bars in which riff energy will change between 0 to 8. 
Default is 2.
+
+@item samples_per_frame
+Set the number of samples per each output frame. Default is 1024.
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Generate 10 seconds of riff music, with a key velocity of 100, instrument as 
Electric Guitar(jazz) 
+and percussion track as Jazz3:
+@example
+atone=d=10:v=100:sfont="example.sf2":instrument=Electric-Guitar-Jazz:percussion=Jazz3
+atone=duration=10:velocity=100:sfont="example.sf2":instrument=Electric-Guitar-Jazz:percussion=Jazz3
+@end example
+@end itemize
+
 @section hilbert
 
 Generate odd-tap Hilbert transform FIR coefficients.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5123540653..b0938830f2 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -152,6 +152,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
 OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
+OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
 
 OBJS-$(CONFIG_ANULLSINK_FILTER)  += asink_anullsink.o
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 1183e40267..90f266a2d9 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -146,6 +146,7 @@ extern AVFilter ff_asrc_flite;
 extern AVFilter ff

Re: [FFmpeg-devel] [PATCHv2][GSoC]audio filter-use cellular automata to generate tones

2020-03-26 Thread Ashutosh Pradhan
On Thu, Mar 26, 2020 at 2:53 PM Nicolas George  wrote:

> Ashutosh Pradhan (12020-03-26):
> > I was trying to random tones using cellular automata (it won't sound good
> > if the tones are too random so I used a scale) for the GSoC audio tones
> > filter project.
>
> Yes, that's already in the doc. What I ask is what good you expect from
> it.
> Since random tones generated using seed( ) was already sent on the mailing
> list, Paul had suggested me to control the duration between tones and to
> generate tones using cellular automata.
> > On Thu, Mar 26, 2020 at 2:41 PM Nicolas George  wrote:
>
> Please remember not to top post on this mailing-list.
>
> Regards,
>
> --
>   Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCHv2][GSoC]audio filter-use cellular automata to generate tones

2020-03-26 Thread Ashutosh Pradhan
I was trying to random tones using cellular automata (it won't sound good
if the tones are too random so I used a scale) for the GSoC audio tones
filter project.

On Thu, Mar 26, 2020 at 2:41 PM Nicolas George  wrote:

> Ashutosh Pradhan (12020-03-26):
> > Use cellular automata and fluidsynth sequencer to generate tones in
> major pentatonic scale
>
> Can you explain the use cases for this filter?
>
> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCHv2][GSoC]audio filter-use cellular automata to generate tones

2020-03-26 Thread Ashutosh Pradhan
Use cellular automata and fluidsynth sequencer to generate tones in major 
pentatonic scale

diff --git a/Changelog b/Changelog
index d1572553a5..5ddd2484b0 100644
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@ version :
 - AMQP 0-9-1 protocol (RabbitMQ)
 - Vulkan support
 - avgblur_vulkan, overlay_vulkan, scale_vulkan and chromaber_vulkan filters
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 6ceb0c7af4..2ec7e377f3 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1770,6 +1771,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3465,6 +3467,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6270,6 +6273,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 328e984e92..193dcaf8e9 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6050,6 +6050,60 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate legato tones using cellular automata.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item MIDI_channel
+Specify the MIDI channel number between(0 to 16) to play tones. Default is 0.
+
+@item tone_change_interval, t
+Specify the time interval between successive tones in seconds. Default is 0.2s.
+
+@item rule
+Specify the rule between 0 to 255 to get the rule set. Default is 30.
+
+@item width
+Specify the width of the cells array. Default is 64.
+
+@item tempo
+Specify the beats per minute. Default is 120.
+
+@item samples_per_frame
+Set the number of samples per each output frame. Default is 1024.
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Generate 10 seconds of random tones, with a key velocity of 100, midi channel 1
+and an tone change interval of 0.1s:
+@example
+atone=d=10:MIDI_channel=1:v=100:t=0.1:sfont="example.sf2":rule=193
+atone=duration=10:MIDI_channel=1:velocity=100:tone_change_interval=0.1:sfont="example.sf2":rule=193
+@end example
+@end itemize
+
 @section hilbert
 
 Generate odd-tap Hilbert transform FIR coefficients.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 750412da6b..b1f0c4be35 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -151,6 +151,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
 OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
+OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
 
 OBJS-$(CONFIG_ANULLSINK_FILTER)  += asink_anullsink.o
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 501e5d041b..4d3efc7e15 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -145,6 +145,7 @@ extern AVFilter ff_asrc_flite;
 extern AVFilter ff_asrc_hilbert;
 extern AVFilter ff_asrc_sinc;
 extern AVF

[FFmpeg-devel] [PATCH][GSoC]audio filter-use cellular automata to generate tones

2020-03-18 Thread Ashutosh Pradhan
Use cellular automata to generate tones

diff --git a/Changelog b/Changelog
index d1572553a5..5ddd2484b0 100644
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@ version :
 - AMQP 0-9-1 protocol (RabbitMQ)
 - Vulkan support
 - avgblur_vulkan, overlay_vulkan, scale_vulkan and chromaber_vulkan filters
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 6ceb0c7af4..2ec7e377f3 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1770,6 +1771,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3465,6 +3467,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6270,6 +6273,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 328e984e92..0eda8a4c6e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6050,6 +6050,57 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate legato tones using cellular automata.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item MIDI_channel
+Specify the MIDI channel number between(0 to 16) to play tones. Default is 0.
+
+@item tone_change_interval, t
+Specify the time interval between successive tones in seconds. Default is 0.2s.
+
+@item rule
+Specify the rule between 0 to 255 to get the rule set. Default is 30.
+
+@item width
+Specify the width of the cells array. Default is 64.
+
+@item samples_per_frame
+Set the number of samples per each output frame. Default is 1024.
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Generate 10 seconds of random tones, with a key velocity of 100, midi channel 1
+and an tone change interval of 0.1s:
+@example
+atone=d=10:MIDI_channel=1:v=100:t=0.1:sfont="example.sf2":rule=193
+atone=duration=10:MIDI_channel=1:velocity=100:tone_change_interval=0.1:sfont="example.sf2":rule=193
+@end example
+@end itemize
+
 @section hilbert
 
 Generate odd-tap Hilbert transform FIR coefficients.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 750412da6b..b1f0c4be35 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -151,6 +151,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
 OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
+OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
 
 OBJS-$(CONFIG_ANULLSINK_FILTER)  += asink_anullsink.o
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 501e5d041b..4d3efc7e15 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -145,6 +145,7 @@ extern AVFilter ff_asrc_flite;
 extern AVFilter ff_asrc_hilbert;
 extern AVFilter ff_asrc_sinc;
 extern AVFilter ff_asrc_sine;
+extern AVFilter ff_asrc_atone;
 
 extern AVFilter ff_asink_anullsink;
 
diff --git a/libavfil

[FFmpeg-devel] [PATCH]GSoC 2020 Audio Tones Source Filter

2020-03-16 Thread Ashutosh Pradhan
Generate random legato tones using fluidsynth api.

diff --git a/Changelog b/Changelog
index d1572553a5..5ddd2484b0 100644
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@ version :
 - AMQP 0-9-1 protocol (RabbitMQ)
 - Vulkan support
 - avgblur_vulkan, overlay_vulkan, scale_vulkan and chromaber_vulkan filters
+- atone filter
 
 
 version 4.2:
diff --git a/configure b/configure
index 6ceb0c7af4..2ec7e377f3 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,7 @@ External library support:
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
+  --enable-libfluidsynth   enable libfluidsynth support for fluidsynth [no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
   --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
   --enable-libfribidi  enable libfribidi, improves drawtext filter [no]
@@ -1770,6 +1771,7 @@ EXTERNAL_LIBRARY_LIST="
 libdc1394
 libdrm
 libflite
+libfluidsynth
 libfontconfig
 libfreetype
 libfribidi
@@ -3465,6 +3467,7 @@ asr_filter_deps="pocketsphinx"
 ass_filter_deps="libass"
 atempo_filter_deps="avcodec"
 atempo_filter_select="rdft"
+atone_filter_deps="libfluidsynth"
 avgblur_opencl_filter_deps="opencl"
 avgblur_vulkan_filter_deps="vulkan libglslang"
 azmq_filter_deps="libzmq"
@@ -6270,6 +6273,7 @@ enabled libfdk_aac&& { check_pkg_config 
libfdk_aac fdk-aac "fdk-aac/aace
  warn "using libfdk without pkg-config"; } }
 flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal 
-lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish 
-lflite_cmulex -lflite"
 enabled libflite  && require libflite "flite/flite.h" flite_init 
$flite_extralibs
+enabled libfluidsynth && require_pkg_config libfluidsynth fluidsynth 
"fluidsynth.h" fluid_log
 enabled fontconfig&& enable libfontconfig
 enabled libfontconfig && require_pkg_config libfontconfig fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config libfreetype freetype2 
"ft2build.h FT_FREETYPE_H" FT_Init_FreeType
diff --git a/doc/filters.texi b/doc/filters.texi
index 328e984e92..4985b29149 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6050,6 +6050,51 @@ anoisesrc=d=60:c=pink:r=44100:a=0.5
 @end example
 @end itemize
 
+@section atone
+
+Generate random legato tones using Fluidsynth API.
+To compile filter configure ffmpeg with @code{--enable-libfluidsynth} 
+
+The filter accepts the following options:
+
+@table @option
+@item sample_rate, r
+Specify the sample rate. Default value is 44100 Hz.
+
+@item sfont
+Specify the location of soundfont file. Default value is 
+"/usr/share/sounds/sf2/FluidR3_GM.sf2"(for linux).
+
+@item duration, d
+Specify the duration of the generated audio stream. Not specifying this option
+results in playing tones for infinite length.
+
+@item velocity, v
+Specify the velocity of key press. Default value is 80.
+
+@item MIDI_channel
+Specify a the MIDI channel number between(0 to 16) to play tones. Default is 0.
+
+@item tone_change_interval, t
+Specify a the time interval between successive tones in seconds. Default is 
0.25s.
+
+@item samples_per_frame
+Set the number of samples per each output frame. Default is 1024.
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Generate 10 seconds of random tones, with a key velocity of 100, midi channel 1
+and an tone change interval of 0.1s:
+@example
+atone=d=10:MIDI_channel=1:v=100:t=0.1:sfont="example.sf2"
+atone=duration=10:MIDI_channel=1:velocity=100:tone_change_interval=0.1:sfont="example.sf2"
+@end example
+@end itemize
+
 @section hilbert
 
 Generate odd-tap Hilbert transform FIR coefficients.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 750412da6b..b1f0c4be35 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -151,6 +151,7 @@ OBJS-$(CONFIG_FLITE_FILTER)  += asrc_flite.o
 OBJS-$(CONFIG_HILBERT_FILTER)+= asrc_hilbert.o
 OBJS-$(CONFIG_SINC_FILTER)   += asrc_sinc.o
 OBJS-$(CONFIG_SINE_FILTER)   += asrc_sine.o
+OBJS-$(CONFIG_ATONE_FILTER)  += asrc_atone.o
 
 OBJS-$(CONFIG_ANULLSINK_FILTER)  += asink_anullsink.o
 
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 501e5d041b..4d3efc7e15 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -145,6 +145,7 @@ extern AVFilter ff_asrc_flite;
 extern AVFilter ff_asrc_hilbert;
 extern AVFilter ff_asrc_sinc;
 extern AVFilter ff_asrc_sine;
+extern AVFilter ff_asrc_atone;
 
 extern AVFilter ff_asink_anullsink;
 
diff --git a/libavfilter/asrc_atone.c b/libavfilter/asrc_atone.c
new file mode 100644
index 00..5588e2a3f5
--- /dev/null
+++ b/libavfilter/asrc_atone.c
@@ -0,0 +1,2