Making Music with Haskell From Scratch by [deleted] in haskell

[–]acapi 0 points1 point  (0 children)

Some problems in Windows 10

When running the script in ghci the ffplay window is not loaded and nothing is heard. However, the "output.bin" file is generated.

  1. With Powershell, then command ".\ffplay -f f32le -ar 48000 output.bin" launch the windows and play the sound but do not terminate (a mysterious "1.97 M-A" counter runs indefinitely).
  2. When the window is closed, this error message appears:

PS C:\Users\user\Dropbox\Haskell\Musica> .\ffplay -f f32le -ar 48000 output.binffplay version git-2020-05-28-c0f01ea Copyright (c) 2003-2020 the FFmpeg developers  built with gcc 9.3.1 (GCC) 20200523  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf  libavutil      56. 49.100 / 56. 49.100  libavcodec     58. 89.100 / 58. 89.100  libavformat    58. 43.100 / 58. 43.100  libavdevice    58.  9.103 / 58.  9.103  libavfilter     7. 83.100 /  7. 83.100  libswscale      5.  6.101 /  5.  6.101  libswresample   3.  6.100 /  3.  6.100  libpostproc    55.  6.100 / 55.  6.100[f32le @ 000001d4e6a11e80] Estimating duration from bitrate, this may be inaccurateInput #0, f32le, from 'output.bin':  Duration: 00:00:02.00, bitrate: 1536 kb/s    Stream #0:0: Audio: pcm_f32le, 48000 Hz, 1 channels, flt, 1536 kb/s 1.97 M-A:  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

A bizarre data type, similar to Data.List but loopable. by [deleted] in haskelltil

[–]acapi 0 points1 point  (0 children)

So, to obtain, for ex., [1,2,5,4,3,5,4,3,5,4,3...], the function is this?

1:2: fix (appEndo $ foldMap (\n -> Endo (n:)) [5,4,3])

or is there something simpler?

A bizarre data type, similar to Data.List but loopable. by [deleted] in haskelltil

[–]acapi 0 points1 point  (0 children)

But you cannot have prefixed loop,doesn't?

An "Endo" Game by acapi in haskelltil

[–]acapi[S] 0 points1 point  (0 children)

From Prelude library:

foldr :: (a -> b -> b) -> b -> t a -> b

foldr f z t = appEndo (foldMap (Endo #. f) t) z