euterpea / euterpea2 Goto Github PK
View Code? Open in Web Editor NEWEuterpea version 2
License: zlib License
Euterpea version 2
License: zlib License
_____ _ | ___| | | | |__ _ _| |_ ___ _ __ _ __ ___ __ _ | __| | | | __/ _ \ '__| '_ \ / _ \/ _` | | |__| |_| | || __/ | | |_) | __/ (_| | \____/\__,_|\__\___|_| | .__/ \___|\__,_| | | |_| Euterpea is a domain-specific language embedded in Haskell for computer music research, education, and development, providing both note-level and signal-level abstractions. It is a descendant of Haskore and HasSound, and is intended for both educational purposes as well as serious computer music applications. Euterpea is a wide-spectrum DSL, suitable for high-level music representation, algorithmic composition, and analysis; mid-level concepts such as MIDI; and low-level audio processing, sound synthesis, and instrument design. It also includes a "musical user interface," a set of computer-music specific GUI widgets such as keyboards, pushbuttons, sliders, and so on. The performance of Euterpea is intended to be as good as any other computer music language, with the goal of being able to develop real-time applications, using both MIDI and a high-performance back-end for real-time audio. See Liense for licensing information. Homepage: http://haskell.cs.yale.edu/ ============================ ==== Getting the Source ==== ============================ Currently (9/2/2015), the most up-to-date version of Euterpea is available through GitHub at: https://github.com/Euterpea/Euterpea We recommend checking out the master version, as it should always be kept stable. When we reach milestones, we will release stable versions to Hackage. ============================ ======= Installation ======= ============================ There is a stable version of Euterpea on Hackage, so one can easily install Euterpea with: cabal install euterpea For the most up to date version, install from source: 1) Clone the source from github git clone https://github.com/Euterpea/Euterpea 2) cd into the Euterpea directory cd Euterpea 3) install Euterpea with cabal cabal install --------- Windows ---------- There are currently no further steps or known issues installing on Windows. ---------- Linux ----------- You may require additional steps to get MIDI sound output working on Linux. First of all, we recommend using TiMidity (http://timidity.sourceforge.net/) and either Freepats (http://freepats.zenvoid.org/) or PersonalCopy (ftp://ftp.personalcopy.net/pub/Unison.sf2.gz) for MIDI support. Make sure timidity is properly depending on the PersonalCopy soundfont if you're using it. Make sure timidity is the default MIDI-Through port. The easiest way to do this is probably to remove the default dummy port: sudo rmmod snd_seq_dummy Then, while Euterpea programs are running, you must have timidity running in the background: timidity -iA -Os & --------- Mac OS X --------- Euterpea is known to work fine on OS X (including Mavericks) when used with GHC 7.8.3 & Haskell Platform 2014.2.0.0 or later. Once Euterpea is set up, you may require additional steps to get MIDI sound output working. Download SimpleSynth and open it before you run ghci. It’s a software MIDI synthesizer that plays MIDI output through the speaker. With GHC 7.8.3 or later, to run the GUI examples in ghci reliably, you need to start gchi with -fno-ghci-sandbox, or set it within ghci as follows: ghci -fno-ghci-sandbox *: :set -fno-ghci-sandbox *: :m + Euterpea.Examples.MUI *: mui5 With older versions of GHC, you may need the ``EnableGUI trick''. See Euterpea/Examples/EnableGUI.hs for details. ------ Troubleshooting ----- If you get errors about packages not being installed, make sure that cabal binaries are in your `$PATH`. To add cabal binaries to your path first add export PATH=$HOME/.cabal/bin:$PATH to your .bashrc and then run source ~/.bashrc Now you should be able to successfully cabal install. ============================ ======= Building HSoM ====== ============================ This Euterpea distribution comes with the source code for the book: The Haskell School of Music, by Paul Hudak. Building the source into a PDF requires LaTeX as well as the package lhs2TeX. Information about LaTeX can be found at http://www.latex-project.org/ and information about lhs2TeX can be found at http://www.andres-loeh.de/lhs2tex/ As lhs2TeX is available on Hackage, it can be installed with cabal: cabal install lhs2tex Once these are ready, building the book can be achieved by running the batch script MakeTex.bat in the HSoM directory. This will compile the lhs files into tex files, the tex files to a dvi, the dvi into a ps, and finally the ps to a pdf. Note that the files of HSoM are Literate Haskell (lhs) files. As such, they can be run directly with GHC. However, the batch script MakeCode.bat will extract just the code. Although they can be regenerated, these extracted files are already included with the Euterpea distribution, and many are important files for the proper functioning of the library. ============================ ====== Getting Started ===== ============================ A good place to begin learning about Euterpea is from the text that accompanies this distribution: The Haskell School of Music, by Paul Hudak. The source files are available in the HSoM directory, and building them to a PDF is described above. Using Euterpea is generally as easy as adding import Euterpea to the imports of your Haskell program. However, for specific advanced uses, other specific imports can be appropriate. Lastly, the Euterpea.Examples subdirectory contains many examples of using Euterpea in practice. These examples are designed to showcase Euterpea's powers, but they may also be useful simply as a starting off point. ============================ ======== Information ======= ============================ Euterpea was created by: Paul Hudak <[email protected]>, Eric Cheng <[email protected]>, Hai (Paul) Liu <[email protected]> and is currently maintained by Paul Hudak <[email protected]>, Donya Quick <[email protected]>, Dan Winograd-Cort <[email protected]> This file was last modified on 9/2/2015 by Daniel Winograd-Cort
on macOS 11.2.2 following import, I get "can't load framework: CoreMIDI (not found)" after any function call, eg.
Prelude Euterpea> devices
can't load framework: CoreMIDI (not found)
I tried reinstalls specifying the CoreMIDI framework & framework path with ghc-options.
Compilation with latest hackage packages fails due to version constraints. Updates of the affected packages don't break Euterpea so adjusting the version constraints like #38 should suffice.
The delta times generated by ExportMidiFile.to7Bits
represent zero as[0x80, 0x00]
and indeed every small value starts with a spurious 0x80
. This is not defined by the Midi file spec, and generally you can get away with it. But loading into Anvil Studio, the file is reported as “corrupt” and has to be manually repaired.
The (tested) fix is trivial – the parameter to padTo
within function to7Bits
should always be 7 and not 8.
Operating System: Microsoft Windows 11 Home Version 22H2, OS Build 22621.2428
GHC version: 9.4.7
cabal version: 3.6.2.0
The instructions at https://www.euterpea.com/ say to use cabal v1-update
but this leads to
cabal-3.6.2.0.exe: unrecognised command: v1-update (try --help)
Maybe you meant `v2-update`?
cabal v2-update
works.
However, the following error occurs on both cabal v1-install
and cabal v2-install
:
Resolving dependencies...
cabal-3.6.2.0.exe: Could not resolve dependencies:
[__0] trying: Euterpea-2.0.8 (user goal)
[__1] next goal: bytestring (dependency of Euterpea)
[__1] rejecting: bytestring-0.11.5.2/installed-0.11.5.2 (conflict: Euterpea =>
bytestring>=0.10.4.0 && <=0.10.9)
[__1] skipping: bytestring-0.12.0.2, bytestring-0.12.0.1, bytestring-0.12.0.0,
bytestring-0.11.5.2, bytestring-0.11.5.1, bytestring-0.11.5.0,
bytestring-0.11.4.0, bytestring-0.11.3.1, bytestring-0.11.3.0,
bytestring-0.11.2.0, bytestring-0.11.1.0, bytestring-0.11.0.0,
bytestring-0.10.12.1, bytestring-0.10.12.0, bytestring-0.10.10.1,
bytestring-0.10.10.0, bytestring-0.10.9.0 (has the same characteristics that
caused the previous version to fail: excluded by constraint '>=0.10.4.0 &&
<=0.10.9' from 'Euterpea')
[__1] trying: bytestring-0.10.8.2
[__2] next goal: base (dependency of Euterpea)
[__2] rejecting: base-4.17.2.0/installed-4.17.2.0 (conflict: bytestring =>
base>=4.2 && <4.15)
[__2] skipping: base-4.19.0.0, base-4.18.1.0, base-4.18.0.0, base-4.17.2.0,
base-4.17.1.0, base-4.17.0.0, base-4.16.4.0, base-4.16.3.0, base-4.16.2.0,
base-4.16.1.0, base-4.16.0.0, base-4.15.1.0, base-4.15.0.0 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=4.2 && <4.15' from 'bytestring')
[__2] rejecting: base-4.14.3.0, base-4.14.2.0, base-4.14.1.0, base-4.14.0.0,
base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__2] fail (backjumping, conflict set: Euterpea, base, bytestring)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, bytestring, Euterpea
I'm curious as to why all the files are Literate Haskell? Seems like a bit of a weird choice for a full on Haskell library. I also think it's stopping Hackage from generating any HTML for the docs 🤔
I'm having fun with Euterpea (just wrote the into to Street Spirit for fun), but it'd be easier to browse the library if there was documentation on Hackage. I'd love to help if possible :)
Following the instructions on the installation page, after installing ghcup, here's what I did and the result:
mac> source ~/.ghcup/env
mac> cabal update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
cabal v2-update 'hackage.haskell.org,2019-10-21T00:19:46Z'
mac> cabal install Euterpea
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: Euterpea-2.0.7 (user goal)
[__1] next goal: Euterpea:setup.Cabal (dependency of Euterpea)
[__1] rejecting: Euterpea:setup.Cabal-2.4.0.1/installed-2.4...,
Euterpea:setup.Cabal-3.0.0.0, Euterpea:setup.Cabal-2.4.1.0,
Euterpea:setup.Cabal-2.4.0.1, Euterpea:setup.Cabal-2.4.0.0 (conflict: Euterpea
=> Euterpea:setup.Cabal>=1.8 && <1.25)
[__1] rejecting: Euterpea:setup.Cabal-2.2.0.1, Euterpea:setup.Cabal-2.2.0.0,
Euterpea:setup.Cabal-2.0.1.1, Euterpea:setup.Cabal-2.0.1.0,
Euterpea:setup.Cabal-2.0.0.2, Euterpea:setup.Cabal-1.24.2.0,
Euterpea:setup.Cabal-1.24.0.0, Euterpea:setup.Cabal-1.22.8.0,
Euterpea:setup.Cabal-1.22.7.0, Euterpea:setup.Cabal-1.22.6.0,
Euterpea:setup.Cabal-1.22.5.0, Euterpea:setup.Cabal-1.22.4.0,
Euterpea:setup.Cabal-1.22.3.0, Euterpea:setup.Cabal-1.22.2.0,
Euterpea:setup.Cabal-1.22.1.1, Euterpea:setup.Cabal-1.22.1.0,
Euterpea:setup.Cabal-1.22.0.0, Euterpea:setup.Cabal-1.20.0.4,
Euterpea:setup.Cabal-1.20.0.3, Euterpea:setup.Cabal-1.20.0.2,
Euterpea:setup.Cabal-1.20.0.1, Euterpea:setup.Cabal-1.20.0.0,
Euterpea:setup.Cabal-1.18.1.7, Euterpea:setup.Cabal-1.18.1.6,
Euterpea:setup.Cabal-1.18.1.5, Euterpea:setup.Cabal-1.18.1.4,
Euterpea:setup.Cabal-1.18.1.3, Euterpea:setup.Cabal-1.18.1.2,
Euterpea:setup.Cabal-1.18.1.1, Euterpea:setup.Cabal-1.18.1,
Euterpea:setup.Cabal-1.18.0, Euterpea:setup.Cabal-1.16.0.3,
Euterpea:setup.Cabal-1.16.0.2, Euterpea:setup.Cabal-1.16.0.1,
Euterpea:setup.Cabal-1.16.0, Euterpea:setup.Cabal-1.14.0,
Euterpea:setup.Cabal-1.12.0, Euterpea:setup.Cabal-1.10.2.0,
Euterpea:setup.Cabal-1.10.1.0, Euterpea:setup.Cabal-1.10.0.0,
Euterpea:setup.Cabal-1.8.0.6, Euterpea:setup.Cabal-1.8.0.4,
Euterpea:setup.Cabal-1.8.0.2, Euterpea:setup.Cabal-1.6.0.3,
Euterpea:setup.Cabal-1.6.0.2, Euterpea:setup.Cabal-1.6.0.1,
Euterpea:setup.Cabal-1.4.0.2, Euterpea:setup.Cabal-1.4.0.1,
Euterpea:setup.Cabal-1.4.0.0, Euterpea:setup.Cabal-1.2.4.0,
Euterpea:setup.Cabal-1.2.3.0, Euterpea:setup.Cabal-1.2.2.0,
Euterpea:setup.Cabal-1.2.1, Euterpea:setup.Cabal-1.1.6,
Euterpea:setup.Cabal-1.24.1.0 (constraint from minimum version of Cabal used
by Setup.hs requires >=2.4)
[__1] fail (backjumping, conflict set: Euterpea, Euterpea:setup.Cabal)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: Euterpea:setup.Cabal, Euterpea
It would be nice to have access to these modes as well: Dorian, Phrygian, Lydian, Mixolydian, and Locrian.
cabal v1-install Euterpea
...
[2 of 7] Compiling Codec.ByteString.Parser ( src/Codec/ByteString/Parser.hs, dist/build/Codec/ByteString/Parser.o, dist/build/Codec/ByteString/Parser.dyn_o )
src/Codec/ByteString/Parser.hs:143:5: error:
‘fail’ is not a (visible) method of class ‘Monad’
|
143 | fail err = Parser $ (S _ _ bytes) ->
| ^^^^
cabal: Leaving directory '/var/folders/df/5d_dsdrx1dn4j30ktsgn8blh0000gp/T/cabal-tmp-24877/HCodecs-0.5.1'
cabal: Error: some packages failed to install:
Trying to install Euterpea
with ghc-8.0.2
and the latest hackage package results in the following errors:
$ cabal update
Downloading the latest package list from hackage.haskell.org
$ cabal sandbox init
Writing a default package environment file to
/home/lukas/tmp/Euterpea2/cabal.sandbox.config
Creating a new sandbox at /home/lukas/tmp/Euterpea2/.cabal-sandbox
$ cabal install Euterpea
Resolving dependencies...
Notice: installing into a sandbox located at
/home/lukas/tmp/Euterpea2/.cabal-sandbox
Configuring heap-1.0.3...
Configuring PortMidi-0.1.5.2...
Configuring lazysmallcheck-0.6...
Configuring primitive-0.6.2.0...
Configuring random-1.1...
Configuring stm-2.4.4.1...
Building heap-1.0.3...
Building primitive-0.6.2.0...
Building stm-2.4.4.1...
Building lazysmallcheck-0.6...
Building random-1.1...
Failed to install PortMidi-0.1.5.2
Build log ( /home/lukas/tmp/Euterpea2/.cabal-sandbox/logs/ghc-8.0.2/PortMidi-0.1.5.2-4P9h5F665SYElLgBFZsRL6.log ):
cabal: Entering directory '/run/user/1000/cabal-tmp-12957/PortMidi-0.1.5.2'
Configuring PortMidi-0.1.5.2...
cabal: Missing dependency on a foreign library:
* Missing C library: asound
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Leaving directory '/run/user/1000/cabal-tmp-12957/PortMidi-0.1.5.2'
Installed lazysmallcheck-0.6
Installed stm-2.4.4.1
Installed heap-1.0.3
Installed random-1.1
Installed primitive-0.6.2.0
cabal: Error: some packages failed to install:
Euterpea-2.0.4-9DWmfQtAXOW95kZGg8IJVr depends on Euterpea-2.0.4 which failed
to install.
PortMidi-0.1.5.2-4P9h5F665SYElLgBFZsRL6 failed during the configure step. The
exception was:
ExitFailure 1
The possible fix is widening the requirements for stm
and PortMidi
in Euterpea.cabal
, so the most recent package versions also match:
stm>=2.4.2 && <2.5,
PortMidi>=0.1.5.3 && < 1.7,
This update breaks nothing in context with stm
only the API change of PortMidi breaks Euterpea. The change is the change from PMMsg
to CLong
here. This, as a result, requires you to call decodeMsg
and encodeMsg
respectively.
The necessary change is exactly my PR, you can view the necessary patch here and apply it yourself (git apply
or something).
MIDI events can sometimes arrive out of order when sent back-to-back. I do not currently know the cause. This will reliably do it on both Windows and Mac with GHC 8.4.3 and 8.6.3 and with both Euterpea 2.0.7 and Euterpea 2.0.6 (so it is not a PortMidi version issue. Likely it was still present in older versions of both GHC and Euterpea since the MIDI backend in question has not changed for a long time.
x = tempo 1.3 $ forever $ c 4 en
play x
Notes will typically be dropped near the start of playback, but it is different each time and often resolves after some time to not dropping any notes. Not all tempo modifiers and durations produce this effect; many are completely safe.
Examining the outgoing MIDI messages reveals that this is sometimes happening with values like x:
[(t1, On), (t2, Off), (t2, On), (t3, Off), ...] -> [(t1, On), (t2, On), (t2, Off), (t3, Off), ...] (pseudocode)
resulting in a infinitesimally small note at time t2 and then silence until t3.
Only "play" and "playDev" are affected, not "playS" on finite portions of the music, indicating that this is something to do with lazy playback.
An immediate fix for anyone suffering from this problem is to substitute use of one of the following playback functions for play and playDev respectively. The strategy taken is to trim an imperceptible amount of duration from the notes to try to avoid having exactly simultaneous note on/off messages whose orders must be interpreted somehow.
import Euterpea
import Euterpea.IO.MIDI.MidiIO
import Control.DeepSeq
play' :: (ToMusic1 a, NFData a) => Music a -> IO ()
play' = playC defParams{perfAlg=fixPerf} where
fixPerf = map (\e -> e{eDur = max 0 (eDur e - 0.000001)}) . perform
playDev' :: (ToMusic1 a, NFData a) => Int -> Music a -> IO ()
playDev' dev = playC defParams{devID = Just (unsafeOutputID dev), perfAlg=fixPerf} where
fixPerf = map (\e -> e{eDur = max 0 (eDur e - 0.000001)}) . perform
This is not an unreasonable solution; most music software I'm aware of does not actually permit simultaneous off-on patterns like Euterpea is attempting to do.
Of course, this will not fix timing issues caused by sever computation bubbles encountered during lazy playback (nor is there any reasonable fix for that scenario).
I'm on Ubuntu 18.10 and have installed Haskell platform from apt-get install, hence, my ghci version is 8.4.2. After cabal update
and cabal install Euterpea
I get this:
. . .
Preprocessing library for Stream-0.4.7.2..
Building library for Stream-0.4.7.2..
: cannot satisfy -package-id QuickCheck-2.11.3-4bkq8vcRuH33iMSCEtmKx6
(use -v for more information)
cabal: Leaving directory '/tmp/cabal-tmp-26799/Stream-0.4.7.2'
cabal: Error: some packages failed to install:
Euterpea-2.0.6-9WYRT4FxrFdFt5QybfOEoa depends on Euterpea-2.0.6 which failed
to install.
HCodecs-0.5.1-44uJSicsHEc2P5wPu9H8Nn failed during the building phase. The
exception was:
ExitFailure 1
Stream-0.4.7.2-23P7z552nGi9cxf0PWrXXx failed during the building phase. The
exception was:
ExitFailure 1
arrows-0.4.4.2-629WjkmAFZW5P7315whiTW depends on arrows-0.4.4.2 which failed
to install.
Not sure what to do next. . . .
The newly released Haskell Platform 8.6.3 includes a version of cabal that requires different syntax. Currently the installation instructions will only work with versions up to 8.4.3.
With 8.6.3, this command series will no longer work:
cabal update
cabal install Euterpea
You will see a complaint from cabal like this...
Warning: The install command is a part of the legacy v1 style of cabal usage.
Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.
...and then it will try to install Euterpea 1.x, which will fail because of problems with the Heap dependency. Attempting to specify the version as Euterpea-2.0.6 also fails, as does downloading Euterpea manually and doing a local cabal install or trying to use runhaskell.
If you try to use new-install, this happens:
_…
Euterpea:setup.Cabal-1.4.0.0, Euterpea:setup.Cabal-1.2.4.0,
Euterpea:setup.Cabal-1.2.3.0, Euterpea:setup.Cabal-1.2.2.0,
Euterpea:setup.Cabal-1.2.1, Euterpea:setup.Cabal-1.1.6,
Euterpea:setup.Cabal-1.24.1.0 (constraint from minimum version of Cabal used
by Setup.hs requires >=2.4)
[_1] fail (backjumping, conflict set: Euterpea, Euterpea:setup.Cabal)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: Euterpea:setup.Cabal, stm, Euterpea,
base
Frustratingly, many cabal-related pages are NOT UP TO DATE with this change in how cabal works even though it's not a hard requirement with the most recent Haskell Platform, so I am having difficulty sorting this out. I am also not quickly finding a guide that shows easily how to transition from the old style to the new style, which is what is needed here.
If anyone happens to be quite familiar with this new cabal version and knows how to do global library installations with it (it does claim v1-style usage should still work...), please describe it here so I can update the instructions and/or Euterpea if it's a library incompatibility and not just an installation syntax issue.
UPDATE 6/04 2020 14:20 : I haven't seen that the installation tutorial tells not to use latest version of ghc, and I've eventually managed to downgrade ghc and install Euterpea
Hello, I've tried several time to install Euterpea with cabal v1 commands, I have the issue mentionned here #36 (comment) by @andreatamez, who said below having fixed the issue downgrading GHCI. I'm a beginner and I don't know really how a simple way to do it. The shell print this
MacBook-Air:~ myname$ cabal v1-update
Downloading the latest package list from hackage.haskell.org
cabal v1-install Euterpea --allow-newer=process
To revert to previous state run:
cabal update --index-state='2020-04-05T23:07:37Z'
MacBook-Air:~ myname$ cabal v1-install Euterpea --allow-newer=process **I've tried within and without that --allow-newer command for the same result**
Resolving dependencies...
Starting HCodecs-0.5.1
Building HCodecs-0.5.1
Failed to install HCodecs-0.5.1
Build log ( /Users/myname/.cabal/logs/ghc-8.8.3/HCodecs-0.5.1-IQAJZaK1RYKLSvGCdgJbmC.log ):
cabal: Entering directory '/var/folders/y2/0hb8j18x2mx699f66shljych0000gn/T/cabal-tmp-66223/HCodecs-0.5.1'
Configuring HCodecs-0.5.1...
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
[1 of 7] Compiling Codec.ByteString.Builder ( src/Codec/ByteString/Builder.hs, dist/build/Codec/ByteString/Builder.o )
src/Codec/ByteString/Builder.hs:79:1: warning: [-Wunused-imports]
The import of ‘Data.Semigroup’ is redundant
except perhaps to import instances from ‘Data.Semigroup’
To import instances alone, use: import Data.Semigroup()
|
79 | import Data.Semigroup
| ^^^^^^^^^^^^^^^^^^^^^
[2 of 7] Compiling Codec.ByteString.Parser ( src/Codec/ByteString/Parser.hs, dist/build/Codec/ByteString/Parser.o )
src/Codec/ByteString/Parser.hs:143:5: error:
‘fail’ is not a (visible) method of class ‘Monad’
|
143 | fail err = Parser $ \(S _ _ bytes) ->
| ^^^^
cabal: Leaving directory '/var/folders/y2/0hb8j18x2mx699f66shljych0000gn/T/cabal-tmp-66223/HCodecs-0.5.1'
cabal: Error: some packages failed to install:
Euterpea-2.0.7-Kx4TpJzFbje3DPmYe0amyd depends on Euterpea-2.0.7 which failed
to install.
HCodecs-0.5.1-IQAJZaK1RYKLSvGCdgJbmC failed during the building phase. The
exception was:
ExitFailure 1
So could you tell me how to downgrade GHCI easily or if ther is a better way to resolve the problem ?
Thank you
Have a nice day
I tried to install with stack using the cabal file below
executable music
hs-source-dirs: src
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
, Euterpea
, HSoM
and stack file
allow-newer: true
resolver: ghc-8.2.1
Other than showing above is just simple template
of stack.
And this is resolved dependencies, but cannot build - output blow
primitive-0.6.2.0: configure
PortMidi-0.1.5.2: download
heap-1.0.3: download
lazysmallcheck-0.6: download
primitive-0.6.2.0: build
heap-1.0.3: configure
heap-1.0.3: build
lazysmallcheck-0.6: configure
heap-1.0.3: copy/register
lazysmallcheck-0.6: build
PortMidi-0.1.5.2: configure
lazysmallcheck-0.6: copy/register
primitive-0.6.2.0: copy/register
PortMidi-0.1.5.2: build
random-1.1: configure
random-1.1: build
stm-2.4.4.1: configure
random-1.1: copy/register
stm-2.4.4.1: build
tf-random-0.5: configure
PortMidi-0.1.5.2: copy/register
tf-random-0.5: build
stm-2.4.4.1: copy/register
tf-random-0.5: copy/register
QuickCheck-2.10.1: configure
QuickCheck-2.10.1: build
QuickCheck-2.10.1: copy/register
HCodecs-0.5: download
Stream-0.4.7.2: download
Stream-0.4.7.2: configure
Stream-0.4.7.2: build
HCodecs-0.5: configure
Stream-0.4.7.2: copy/register
arrows-0.4.4.1: download
HCodecs-0.5: build
arrows-0.4.4.1: configure
arrows-0.4.4.1: build
arrows-0.4.4.1: copy/register
HCodecs-0.5: copy/register
StateVar-1.1.0.4: configure
fixed-0.2.1.1: download
ObjectName-1.1.0.1: download
StateVar-1.1.0.4: build
ObjectName-1.1.0.1: configure
StateVar-1.1.0.4: copy/register
half-0.2.2.3: download
ObjectName-1.1.0.1: build
fixed-0.2.1.1: configure
ObjectName-1.1.0.1: copy/register
markov-chain-0.0.3.4: download
fixed-0.2.1.1: build
Euterpea-2.0.4: configure
fixed-0.2.1.1: copy/register
pure-fft-0.2.0: download
Euterpea-2.0.4: build
half-0.2.2.3: configure
half-0.2.2.3: build
markov-chain-0.0.3.4: configure
half-0.2.2.3: copy/register
pure-fft-0.2.0: configure
markov-chain-0.0.3.4: build
markov-chain-0.0.3.4: copy/register
pure-fft-0.2.0: build
text-1.2.2.2: configure
pure-fft-0.2.0: copy/register
text-1.2.2.2: build
Euterpea-2.0.4: download
Euterpea-2.0.4: configure
Euterpea-2.0.4: build
Euterpea-2.0.4: copy/register
removeDirectoryRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:RemoveDirectory "D:\\Users\\applePrincess\\AppData\\Local\\Temp\\stack13020\\Euterpea-2.0.4\\.stack-work\\dist\\e53504d9\\setup": unsatisfied constraints (Directory is not empty.)
and if I run stack build
again, the installation is succeeded.
OS: Windows 10 (64-bit)
stack version: Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e x86_64 hpack-0.17.1
MacMini:bin user$ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/ :? for help
Loaded package environment from /Users/serge/.ghc/x86_64-darwin-8.8.4/environments/default
Prelude> import Euterpea
: error:
Could not find module ‘Euterpea’
It is not a module in the current program, or in any known package.
I used ghcup to install Haskell in /Users/{username}/.ghcup/bin
(Edited to add last line)
How to build using stack with lts-7.19 and Haskell Platform 8.0.1 on Windows XP? I've tried with the following in stack.yaml, but I am getting errors:
resolver: lts-7.19
extra-deps:
- Euterpea-2.0.2
- PortMidi-0.1.5.2
- heap-0.6.0
- arrows-0.4.4.1
- Stream-0.4.7.2
- lazysmallcheck-0.6
The output is:
J:\dev\hp\projects\music>stack build
While constructing the BuildPlan the following exceptions were encountered:
-- Failure when adding dependencies:
stm: needed (==2.4.2), 2.4.4.1 found (latest applicable is 2.4.2)
needed for package Euterpea-2.0.2
-- Failure when adding dependencies:
Euterpea: needed (-any), couldn't resolve its dependencies
needed for package music-0.1.0.0
Because of its dependency on an old version of PortMidi this currently happens, when installing:
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/setup-package.conf.d -j1 -threaded
[1 of 1] Compiling Main ( Setup.hs, /build/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/vqxr1zdzgvx9lwd4acbqjkj58pc26aiy-Euterpea-2.0.5 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --docdir=/nix/store/5bfbip1w8ldcqqlj70mxjjrfigk7b8ld-Euterpea-2.0.5-doc/share/doc/Euterpea-2.0.5 --with-gcc=gcc --package-db=/build/package.conf.d --ghc-option=-j1 --disable-split-objs --enable-library-profiling --profiling-detail=all-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --enable-library-vanilla --enable-library-for-ghci --ghc-option=-split-sections --extra-lib-dirs=/nix/store/w8bxy3xrvrd1ci5772y7arkicj0q7x3h-ncurses-6.1/lib --extra-lib-dirs=/nix/store/d60s5bwv6r3hl6w8cg5j7znwaiva43n8-gmp-6.1.2/lib
Using Parsec parser
Configuring Euterpea-2.0.5...
CallStack (from HasCallStack):
die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:958:20 in Cabal-2.2.0.1:Distribution.Simple.Configure
configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:462:12 in Cabal-2.2.0.1:Distribution.Simple.Configure
configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in Cabal-2.2.0.1:Distribution.Simple
confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.2.0.1:Distribution.Simple.UserHooks
configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178:19 in Cabal-2.2.0.1:Distribution.Simple
defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:115:27 in Cabal-2.2.0.1:Distribution.Simple
defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
PortMidi ==0.1.6.1
I've submitted a fix as #22, which can also be downloaded as a patch.
My first attempt to use Euterpea to transcribe some simple piano music resulted in a corrupt Midi file with badly interleaved NoteOn and NoteOff events for the same note. It took me quite a while to understand this with a couple of false analyses [Sorry Donya for the spurious mails]. But the outcome shows a problem in the underlying Euterpea modelling of note-level music such that any fix would unfortunately be pervasive through the book!
The particular problem example is illustrated by the attached music image and Haskell file. In bar 2 left hand, there is a D held for much of the bar. But the right had also plays that same D at the same time. This is a common piano idiom. When the music is exported as a Midi file, the NoteOn/NoteOff events are then incorrectly interleaved. This can be seen in the text dump of the Midi file – search for occurrences of “d4”.
The underlying problem is the lack of a model for separate tracks, which are independent sequences of played notes. The aggregation of the music into an amorphous “bucket of notes” which are then split into one track per instrument does not work in this case. Unfortunately, this is not the same note-level model as is used by Midi.
I could consider a fix for this particular case which “fixes up” the NoteOn and NoteOff for each note such that it becomes well formed, while preserving the timing. But that would be a fix only for limited cases – for example it would not work for a two piano piece or a string quartet with two violins.
So I wonder if it is too late to consider a change of the Music model in Euterpea to add the concept of a “track” Is this something that could be added through a new Control?
The simplest solution I can think of is to change the Instrument
Control
constructor to take a parameter of type (InstrumentName, String)
, where the second component of the tuple is a track name, such as “Left hand” or “2nd fiddle”. The instrument
function then becomes
instrument i m = Modify (Instrument (i, i)) m
and we have a new function
instrumentTrack i n m = Modify (Instrument (i, n)) m
Rippling through the dependencies should then be easy as the compiler will pick them all up. And the only consequential functional change will be in the ToMidi
construction of the UserPatchMap
.
Does the problem make sense? Is the proposed solution worthwhile? I realize that it will still have some implication of the text of the book which explains the existing code.
Hi! I'm experiencing issues while installing the Euterpea Haskell package on my macOS Sonoma 14.5 system with GHC 9.4.8 and Cabal 3.10.3.0.
The initial issue is a compilation error in the PortMidi 0.2.0.0 package, specifically in the portmidi/pm_mac/pmmacosxcm.c:60:22 file. The error is:
error: incompatible pointer to integer conversion initializing 'MIDIClientRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
To resolve this, I followed the instructions in the PortMidi (https://github.com/PortMidi/portmidi/blob/8efac0cfe6c245aeb2ce5122aa2b82fb79e91463/pm_mac/pmmacosxcm.c#L187), downloaded the PortMidi-Haskell package, and added #define NULL 0
to the portmidi/pm_mac/pmmacosxcm.c file. After doing this, I was able to successfully install the PortMidi-Haskell and Euterpea using cabal v1-install
.
However, when I try to import the Euterpea package in GHCi, I encounter a different issue:
λ> import Euterpea
<interactive>:1:1: error:
attempting to use module ‘main:Euterpea’ (./Euterpea.lhs) which is not loaded
λ> :l Euterpea.lhs
[ 1 of 18] Compiling Control.Arrow.ArrowP ( Control/Arrow/ArrowP.lhs, interpreted )
[ 2 of 18] Compiling Control.SF.SF ( Control/SF/SF.lhs, interpreted )
[ 3 of 18] Compiling Euterpea.IO.Audio.Types ( Euterpea/IO/Audio/Types.hs, interpreted )
[ 4 of 18] Compiling Euterpea.IO.Audio.IO ( Euterpea/IO/Audio/IO.hs, interpreted )
[ 5 of 18] Compiling Euterpea.IO.MIDI.ExportMidiFile ( Euterpea/IO/MIDI/ExportMidiFile.lhs, interpreted )
[ 6 of 18] Compiling Euterpea.IO.MIDI.MidiIO ( Euterpea/IO/MIDI/MidiIO.lhs, interpreted )
Euterpea/IO/MIDI/MidiIO.lhs:327:5: error:
parse error (possibly incorrect indentation or mismatched brackets)
|
327 | > case m of
| ^
[ 7 of 18] Compiling Euterpea.Music ( Euterpea/Music.lhs, interpreted )
[ 8 of 18] Compiling Euterpea.IO.MIDI.MEvent ( Euterpea/IO/MIDI/MEvent.lhs, interpreted )
[ 9 of 18] Compiling Euterpea.IO.MIDI.GeneralMidi ( Euterpea/IO/MIDI/GeneralMidi.hs, interpreted )
[14 of 18] Compiling Euterpea.IO.Audio.Basics ( Euterpea/IO/Audio/Basics.hs, interpreted )
[15 of 18] Compiling Euterpea.IO.Audio.Render ( Euterpea/IO/Audio/Render.hs, interpreted )
[16 of 18] Compiling Euterpea.IO.Audio.BasicSigFuns ( Euterpea/IO/Audio/BasicSigFuns.lhs, interpreted )
[17 of 18] Compiling Euterpea.IO.Audio ( Euterpea/IO/Audio.hs, interpreted )
Failed, 12 modules loaded.
> deliverMidiEvent :: OutputDeviceID -> MidiEvent -> IO ()
> deliverMidiEvent devId (t,m) = do
> (pChan, out, _stop) <- getOutDev devId
> now <- getTimeNow
> let deliver t m = do
> if t == 0
> then out (now,m)
> else push pChan (now+t) m
>
> case m of
> Std m -> deliver t m
> ANote c k v d -> do
> deliver t (NoteOn c k v)
> deliver (t+d) (NoteOff c k v)
I'm new to Haskell and I found this parse error in the Euterpea/IO/MIDI/MidiIO.lhs file really confusing. Any advice or suggestions would be greatly appreciated.
Please let me know if this isn't the right place to ask! I didn't find any forums where these things could be discussed.
I was playing with the library and was surprised to find that (Staccato 2 1)
and (Legato 2 1)
sounded the same. Then I took a look at the code and found out the implementations were actually equal. I thought, well, maybe the implementation is a bit behind? But then I downloaded the HSoM book and saw that the implementation described in the book is exactly that.
Is there any rationale behind this? As a musician, I'd expect "somewhat Staccato" to be different than "somewhat Legato".
Again, I apologize if this is not actually the right place to ask :).
Hi there,
as a practitioner of creative (live) coding I would like to have SuperCollider support (and not only MIDI and CSound). I would love to use Haskell for creative endeavours, but Overtone is really tempting given its feature set.
Cheers,
tpltnt
logs:
PS C:\WINDOWS\system32> cabal v1-install Euterpea
Resolving dependencies...
Downloading PortMidi-0.2.0.0
Downloading bytestring-0.10.8.2
Downloaded PortMidi-0.2.0.0
Downloading heap-1.0.4
Downloaded bytestring-0.10.8.2
Downloading lazysmallcheck-0.6
Downloaded heap-1.0.4
Downloading semigroups-0.19.1
Starting PortMidi-0.2.0.0
Downloaded lazysmallcheck-0.6
Starting heap-1.0.4
Downloaded semigroups-0.19.1
Starting semigroups-0.19.1
Starting bytestring-0.10.8.2
Starting lazysmallcheck-0.6
Building PortMidi-0.2.0.0
Building heap-1.0.4
Building semigroups-0.19.1
Building lazysmallcheck-0.6
Building bytestring-0.10.8.2
Completed semigroups-0.19.1
Completed lazysmallcheck-0.6
Completed heap-1.0.4
Completed PortMidi-0.2.0.0
Completed bytestring-0.10.8.2
Downloading Win32-2.9.0.0
Downloaded Win32-2.9.0.0
Starting Win32-2.9.0.0
Building Win32-2.9.0.0
Failed to install Win32-2.9.0.0
Build log ( C:\Users\maste\AppData\Roaming\cabal\logs\ghc-8.10.2\Win32-2.9.0.0-EPfUgG2Fx9tFAt2DQemzpq.log ):
Preprocessing library for Win32-2.9.0.0..
Building library for Win32-2.9.0.0..
[ 1 of 65] Compiling System.Win32.Exception.Unsupported ( System\Win32\Exception\Unsupported.hs, dist\build\System\Win32\Exception\Unsupported.o )
[ 2 of 65] Compiling System.Win32.Types ( dist\build\System\Win32\Types.hs, dist\build\System\Win32\Types.o )
[ 3 of 65] Compiling System.Win32.Time ( dist\build\System\Win32\Time.hs, dist\build\System\Win32\Time.o )
[ 4 of 65] Compiling System.Win32.String ( System\Win32\String.hs, dist\build\System\Win32\String.o )
[ 5 of 65] Compiling System.Win32.Security ( dist\build\System\Win32\Security.hs, dist\build\System\Win32\Security.o )
[ 6 of 65] Compiling System.Win32.NLS ( dist\build\System\Win32\NLS.hs, dist\build\System\Win32\NLS.o )
[ 7 of 65] Compiling System.Win32.Mem ( dist\build\System\Win32\Mem.hs, dist\build\System\Win32\Mem.o )
[ 8 of 65] Compiling System.Win32.Info ( dist\build\System\Win32\Info.hs, dist\build\System\Win32\Info.o )
[ 9 of 65] Compiling System.Win32.File ( dist\build\System\Win32\File.hs, dist\build\System\Win32\File.o )
[10 of 65] Compiling System.Win32.SymbolicLink ( dist\build\System\Win32\SymbolicLink.hs, dist\build\System\Win32\SymbolicLink.o )
[11 of 65] Compiling System.Win32.Registry ( dist\build\System\Win32\Registry.hs, dist\build\System\Win32\Registry.o )
[12 of 65] Compiling System.Win32.Path ( dist\build\System\Win32\Path.hs, dist\build\System\Win32\Path.o )
[13 of 65] Compiling System.Win32.HardLink ( System\Win32\HardLink.hs, dist\build\System\Win32\HardLink.o )
[14 of 65] Compiling System.Win32.FileMapping ( dist\build\System\Win32\FileMapping.hs, dist\build\System\Win32\FileMapping.o )
[15 of 65] Compiling System.Win32.DebugApi ( dist\build\System\Win32\DebugApi.hs, dist\build\System\Win32\DebugApi.o )
[16 of 65] Compiling System.Win32.Thread ( System\Win32\Thread.hs, dist\build\System\Win32\Thread.o )
[17 of 65] Compiling System.Win32.Process ( dist\build\System\Win32\Process.hs, dist\build\System\Win32\Process.o )
[18 of 65] Compiling System.Win32.DLL ( dist\build\System\Win32\DLL.hs, dist\build\System\Win32\DLL.o )
[19 of 65] Compiling Graphics.Win32.Resource ( dist\build\Graphics\Win32\Resource.hs, dist\build\Graphics\Win32\Resource.o )
[20 of 65] Compiling Graphics.Win32.Message ( dist\build\Graphics\Win32\Message.hs, dist\build\Graphics\Win32\Message.o )
[21 of 65] Compiling Graphics.Win32.GDI.Types ( dist\build\Graphics\Win32\GDI\Types.hs, dist\build\Graphics\Win32\GDI\Types.o )
[22 of 65] Compiling System.Win32.SimpleMAPI ( dist\build\System\Win32\SimpleMAPI.hs, dist\build\System\Win32\SimpleMAPI.o )
[23 of 65] Compiling System.Win32.Shell ( dist\build\System\Win32\Shell.hs, dist\build\System\Win32\Shell.o )
[24 of 65] Compiling Graphics.Win32.Window.PostMessage ( dist\build\Graphics\Win32\Window\PostMessage.hs, dist\build\Graphics\Win32\Window\PostMessage.o )
[25 of 65] Compiling Graphics.Win32.Window.AnimateWindow ( dist\build\Graphics\Win32\Window\AnimateWindow.hs, dist\build\Graphics\Win32\Window\AnimateWindow.o )
[26 of 65] Compiling Graphics.Win32.Window ( dist\build\Graphics\Win32\Window.hs, dist\build\Graphics\Win32\Window.o )
ghc.exe: could not execute: C:/GitLabRunner/builds/2WeHDSFP/0/ghc/ghc/inplace/mingw/bin/ld.exe
cabal: Leaving directory 'C:\Users\maste\AppData\Local\Temp\cabal-tmp-11108\Win32-2.9.0.0'
cabal.exe: Error: some packages failed to install:
Euterpea-2.0.7-6vOzXFQEAEpSQebQpj4oe depends on Euterpea-2.0.7 which failed to
install.
HCodecs-0.5.1-K8REhzFuLy55nvJ6hna2p1 depends on HCodecs-0.5.1 which failed to
install.
QuickCheck-2.14.1-GUeF9hZfEIbB1XLk6l5yis depends on QuickCheck-2.14.1 which
failed to install.
Stream-0.4.7.2-6NJiXYwzghdAlgemj66SEb depends on Stream-0.4.7.2 which failed
to install.
Win32-2.9.0.0-EPfUgG2Fx9tFAt2DQemzpq failed during the building phase. The
exception was:
ExitFailure 1
arrows-0.4.4.2-LB3XI7kxdYPKBZ8D22vCkw depends on arrows-0.4.4.2 which failed
to install.
random-1.1-EZDk0Wy9E2fJc9XB8N115r depends on random-1.1 which failed to
install.
splitmix-0.1.0.1-CEtbg7mzKF36qgXlhVRs8C depends on splitmix-0.1.0.1 which
failed to install.
time-1.10-4Ru8klpD7Pq7FDA2fXxtoz depends on time-1.10 which failed to install.
Installing Euterpea with ghcup fails on OS X 10.14 (Mojave) with cabal version errors. I don't have a solution for ghcup at present but am looking into it.
Using an older version of Haskell Platform's dedicated installer (like 8.6.3) is one option as a workaround.
Could you push them? See notes
section in upload instructions.
Is it the final note velocity?
Also, would it be possible to create a more expressive alias, a la Dur?
Thanks!
Will not build on current Haskell Platform version with stricter dependencies on Hackage.
Found the HSoM book in a bookshop today and was intrigued so bought it, and after hours of trying to get anything to run I'm close to giving up.
I've got to the point of a MIDI note playing but either GHCi or compiled files crash as soon as one note plays. Anything after a single note (or chord) doesn't play as the system crashes back to a prompt (and back out of GHCi). There are no warnings, logs or other messages and the inital midi note on is certainly sent. devices
lists devices fine and doesn't crash. So I suspect things are installed correctly but something about the midi system is crashing. I've output both to windows default midi and a virtual midi port and get the same results. A single message is sent / sound is played and then it dies.
There's this section in the troubleshooting section which seems similar:
(Windows MIDI playback) Calling the “play” function on any Music value crashes GHCi.
This can happen with the 64-bit versions of Haskell Platform on pre-creators update Windows 10 and on any version of Windows with Haskell Platform 8.0.1 or earlier. For older versions of Windows and/or older versions of Haskell Platform, please use the 32-bit version on Windows if you want to work within GHCi. Alternatively, try compiling your program to an executable with GHC.
But I've tried various versions of GHC (downgrading it to match what's in the docs) and compiling it and it's always the same. I'm on Windows 11 which I hope this is possible to get running on.
Anyone who can offer any troubleshooting help or modern advice on how to get this running would be greatly appreciated as it'd be sad if the book just gets put on a shelf / binned and never used as was intrigued being both a composer and a programmer with some haskell knowledge.
Followed instruction on Haskell.org & Euterpea, installed ghci & cabal;
Used cabal v1-install, for cabal --version = 3.2.0.0, ghci --verson =8.10.x
==================
logs are printed below:
PS C:\WINDOWS\system32> cabal v1-update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
cabal update --index-state='2020-11-14T19:24:56Z'
PS C:\WINDOWS\system32> cabal v1-install Euterpea
Resolving dependencies...
Downloading PortMidi-0.2.0.0
Downloading bytestring-0.10.8.2
Downloaded PortMidi-0.2.0.0
Downloading heap-1.0.4
Downloaded bytestring-0.10.8.2
Downloading lazysmallcheck-0.6
Starting PortMidi-0.2.0.0
Starting bytestring-0.10.8.2
Downloaded heap-1.0.4
Downloading semigroups-0.19.1
Starting heap-1.0.4
Downloaded lazysmallcheck-0.6
Downloading splitmix-0.1.0.3
Starting lazysmallcheck-0.6
Downloaded semigroups-0.19.1
Starting semigroups-0.19.1
Downloaded splitmix-0.1.0.3
Starting splitmix-0.1.0.3
Building PortMidi-0.2.0.0
Building bytestring-0.10.8.2
Building heap-1.0.4
Building lazysmallcheck-0.6
Building semigroups-0.19.1
Building splitmix-0.1.0.3
Completed semigroups-0.19.1
Completed lazysmallcheck-0.6
Completed heap-1.0.4
Completed splitmix-0.1.0.3
Completed PortMidi-0.2.0.0
Completed bytestring-0.10.8.2
Downloading Win32-2.10.1.0
Downloaded Win32-2.10.1.0
Starting Win32-2.10.1.0
Building Win32-2.10.1.0
Completed Win32-2.10.1.0
Downloading time-1.11
Downloaded time-1.11
Starting time-1.11
Failed to install time-1.11
Build log ( C:\Users\12798\AppData\Roaming\cabal\logs\ghc-8.10.2\time-1.11-F1Qsy6rxZ47IoWwgcSJwTt.log ):
Configuring time-1.11...
cabal.exe: The package has a './configure' script. If you are on Windows, This
requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. If you
are not on Windows, ensure that an 'sh' command is discoverable in your path.
cabal: Leaving directory 'C:\Users\12798\AppData\Local\Temp\cabal-tmp-15788\time-1.11'
cabal.exe: Error: some packages failed to install:
Euterpea-2.0.7-ColvwyaxypFCnc4FRIvJLb depends on Euterpea-2.0.7 which failed
to install.
HCodecs-0.5.1-AAjS44xnOv9HSlbJcq9x2A depends on HCodecs-0.5.1 which failed to
install.
QuickCheck-2.14.1-Ebkcmho0B6yDKxHRXytSEu depends on QuickCheck-2.14.1 which
failed to install.
Stream-0.4.7.2-90g1dX2sDa3C8AXsrJox3t depends on Stream-0.4.7.2 which failed
to install.
arrows-0.4.4.2-DJpYj03BhLOKVYmYpYuBSZ depends on arrows-0.4.4.2 which failed
to install.
random-1.1-85k8850AB1II1hH9qRabRQ depends on random-1.1 which failed to
install.
time-1.11-F1Qsy6rxZ47IoWwgcSJwTt failed during the configure step. The
exception was:
ExitFailure 1
I get the following:
Euterpea-2.0.4-IH6Nu782fPx3goQpmjSLG0 depends on Euterpea-2.0.4 which failed
to install.
Using Mac OSX.13.4 64-Bit
Hi there,
To fix the installation issues with new-style Cabal, you can either:
build-type: Custom
with build-type: Simple
in Euterpea.cabal
Euterpea.cabal
:custom-setup
setup-depends: Cabal, base
If Setup.hs
needs any dependencies other than Cabal
and base
, use build-type: Custom
and list the dependencies; otherwise, use build-type: Simple
.
See #26 (comment).
I've wanted to use this library for so long, but could never get it working with Cabal. Now that I know what the problem is, I look forward to being able to build and use it! Thank you for your work maintaining Euterpea!
I must take issue with the reply to a separate post in the Euterpea1 project - https://github.com/Euterpea/Euterpea/issues/31 That reply said:
The effect of the Tempo modifier you have observed is not a bug; you're seeing the intended behavior. Tempo modifiers to allow for musical structures that do not adhere to the standard MIDI notion of beats and measures. The scaling of the offsets also allows for easier integration with MIDI streams. If you want write a MIDI file with a specific tempo, you can construct the music value as for 120bpm and then, within Euterpea 2, you can use a combination of the perform and toMidi functions to access the intermediate Midi type (which belongs to Codec.Midi) and alter timeDiv as desired.
My understanding is that is NOT how tempo should be handled in Midi files. I would expect any tempo modifier to correspond to a marked change in tempo within the music, to allow for faster and slower sections within a single piece of music without breaking the structure of the music in terms of beats and bars. Indeed, I would hope that later enhancements could allow for changing time signatures, although that would need the addition of a further Control constructor, such as “TimeSig Rational”.
This means that writing Midi files is different from playing to a Midi device in that tempo changes should NOT scale the durations, but simply insert the appropriate “Set Tempo” (FF 51 03 tt tt tt) meta event, with a restoring meta event at the end of the tempo-modified section. This is further divergence of the representation of Midi used for playing from that used for exporting.
Maybe this is pushing Euterpea into capabilities beyond its pedagogical role. But either we need to accept significant limitations in the music that it can handle, or we need to push for such fixes and enhancements. It seems so close!
Hello there,
I am currently working on a project where I am using Euterpea2. I try to read the MIDI signals and then play the corresponding note. (see below) Instead of reading the note only when play would "need" it, it is all the time reading and therefore never playing. When I try to call play everytime I get MIDI signals I get warnings that devices were left open. (also attached) Do you have any suggestion how to deal with this issue?
Thanks in advance!
Cheers, Florian
This would involve replacing the deprecated functions Heap.extractHeap and Heap.head in MidiIO. Sorry I haven't got a PR.
Hello,
I wonder if I can use Euterpea to play music in a game?
I tried this very simple test, where x1 is one of the example songs:
import Euterpea
main = play x1
And I get the error : "No MIDI output device found"
Should the game itself implement a virtual midi device that receives midi events?
By any chance do you know any example of how to do this in Haskell?
Thanks!
I manage to successfully install Euterpea following the instructions on the web page but I wasn´t able to import it into ghci.
Kernel: 6.0.6-zen1-1-zen
DE: KDE Plasma
OS: Garuda Linux
rm -rf .cabal .ghc
ghcup tui
and install ghc 8.10.7. During ghcup installation you should be prompted for cabal installation, which at this time installs 9.2.4 by default (which is ok, you can have more than one version of ghc without conflict)ghcup tui
set ghc 8.10.7cabal v1-install --allow-newer
(without the last flag it fails in my system).ghci
and then import Euterpea
This results in
$ ghci
Loaded package environment from /home/user/.ghc/x86_64-linux-9.2.4/environments/default
GHCi, version 9.2.4: https://www.haskell.org/ghc/ :? for help
ghci> import Euterpea
<no location info>: error:
Could not find module ‘Euterpea’
It is not a module in the current program, or in any known package.
Using the cabal v1 repl also fails: cabal v1-repl
and then import Euterpea
results in the same error.
cat ~/.ghc/x86_64-linux-8.10.7/environments/default
nor in ls ~/.cabal/store/ghc-8.10.7/package.db/
even though ghc-pkg list
lists Euterpea-2.0.8
and the library also appears in ls .cabal/lib/x86_64-linux-ghc-8.10.7/
ghcup tui
) to the same results.After all this (without clearing the previous steps) I set ghc 8.10.7 back(because most of my installed packages use this version). I then tried the following command:
cabal install Euterpea --lib --allow-newer
Again, without the last flag the command fails. With this the package is downloaded from Hackage instead of this repo.
I haven´t tried this command to install from the repo directory, but it should also work.
Now I was able to import the library and Euterpea appears in:
ls .cabal/store/ghc-8.10.7/package.db/
and
cat ~/.ghc/x86_64-linux-8.10.7/environments/default
I don´t get exactly how the different cabal commands behave and why they differ in results, neither where this issue should be fixed (the Euterpea.cabal? or all the way into the cabal build system or command?).
For the moment I suggest adding the above successful command as an option in the installation instructions.
I believe there may be valuable documentation there, such as how to set up a softsynth.
Thanks.
While installing Euterpea from cabal using command "cabal v1-install Euterpea", I found HCodecs-0.5.1 was required and always failed while building
So I check on Hackage.Haskell.org, figured out there exist HCodecs-0.5.2;
As assuming the fail of build is due to out-of-date version, I separately install HCodecs-0.5.2, (which run succeed), then tried run "cabal v1-install Euterpea" again, to my surprise, the install did not skip version check for HCodes even I installed a latest version of HCodecs-0.5.2
Here is the log the reflecting my separate install of HCodecs-0.5.2 & the fail building of installing HCodecs0.5.1:
PS C:\WINDOWS\system32> cabal v1-install HCodecs-0.5.2
Resolving dependencies...
Downloading fail-4.9.0.0
Downloaded fail-4.9.0.0
Starting fail-4.9.0.0
Building fail-4.9.0.0
Completed fail-4.9.0.0
Downloading HCodecs-0.5.2
Downloaded HCodecs-0.5.2
Starting HCodecs-0.5.2
Building HCodecs-0.5.2
Completed HCodecs-0.5.2
PS C:\WINDOWS\system32> cabal v1-install Euterpea
Resolving dependencies...
Starting HCodecs-0.5.1
Building HCodecs-0.5.1
Failed to install HCodecs-0.5.1
Build log ( C:\Users\12798\AppData\Roaming\cabal\logs\ghc-8.10.2\HCodecs-0.5.1-KovArVTnpFnLaEvHYYD8GP.log ):
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
[1 of 7] Compiling Codec.ByteString.Builder ( src\Codec\ByteString\Builder.hs, dist\build\Codec\ByteString\Builder.o )
src\Codec\ByteString\Builder.hs:79:1: warning: [-Wunused-imports]
The import of Data.Semigroup' is redundant except perhaps to import instances from
Data.Semigroup'
To import instances alone, use: import Data.Semigroup()
|
79 | import Data.Semigroup
| ^^^^^^^^^^^^^^^^^^^^^
[2 of 7] Compiling Codec.ByteString.Parser ( src\Codec\ByteString\Parser.hs, dist\build\Codec\ByteString\Parser.o )
src\Codec\ByteString\Parser.hs:143:5: error:
fail' is not a (visible) method of class
Monad'
|
143 | fail err = Parser $ (S _ _ bytes) ->
| ^^^^
cabal: Leaving directory 'C:\Users\12798\AppData\Local\Temp\cabal-tmp-13328\HCodecs-0.5.1'
cabal.exe: Error: some packages failed to install:
Euterpea-2.0.7-16Dwojok2ejBacdiDIytTu depends on Euterpea-2.0.7 which failed
to install.
HCodecs-0.5.1-KovArVTnpFnLaEvHYYD8GP failed during the building phase. The
exception was:
ExitFailure 1
that is mist confusing, for the version check did not skip Hcodecs-0.5.1
Dependency problems with Haskell Platform 8.2.1 are being investigated. Both core and full versions are problematic.
You may need to use the older Haskell Platform 8.0.2 as recommended on the download and installation page: http://euterpea.com/download-and-installation/
I wanted to use the diatonic scale, and transpose inside the scale. E.g.,
transpose 1 c
should give d
(whole note up), but transpose 1 e
should give f
(semi note up),
and a chord is [x, x+2, x+4], giving major, minor, or dim, depending on x
.
Electribe2 does have such a chord mode.
Euterpea has chromatic scale everywhere, because MIDI does.
Still the source code (and API docs) mention Mode
. But it's never used?
rg Major Euterpea2/
Euterpea2/Euterpea/Music.lhs
38:> data Mode = Major | Minor |
Euterpea's class ToMusic
is already designed (I guess) to handle this:
One can make a newtype
data Diatonic = Diatonic Int
and define conversion to chromatic (via some table lookup)
instance ToMusic1 Diatonic where
toMusic1 = mMap ( \ (Diatonic i) -> (pitch _, _) )
Then, transposition in the scale works
tr_dia d = mMap (\ (Diatonic i) -> Diatonic (i+d))
play $ tr_dia 2 $ note 1 $ Diatonic 0
The nice thing is that the type system will prohibit a confusion of scales (using a diatonic number as it were chromatic).
I'm sorry if this is the wrong place to ask. I am making a program where the user selects three chords out of nine to make their own chord progression, and the user can change the progression on the fly. I have the list of chords, and I'm able to convert it to a Codec.Midi.Midi. However I'm not sure if I can get all the way to [MidiMessage]. I've attached what I have so far.
Thank you and sorry if this is the wrong place for this.
{-# LANGUAGE Arrows #-}
module Main where
import HSoM
import FRP.UISF
import Euterpea
import Data.Maybe (mapMaybe)
import Euterpea.Music
import Euterpea.IO.MIDI.MEvent
import Euterpea.IO.MIDI.GeneralMidi
import Euterpea.IO.MIDI.MidiIO
import Euterpea.IO.MIDI.ExportMidiFile
import Sound.PortMidi
import Codec.Midi
chord_1 = chord [e 5 wn, b 5 wn]
chord_2 = chord [c 5 wn, e 5 wn]
chord_3 = chord [b 4 wn, f 5 wn]
chord_4 = chord [d 3 wn, g 2 wn]
chord_5 = chord [g 1 wn, b 7 wn]
chord_6 = chord [d 7 wn, e 1 wn]
chord_7 = chord [e 5 wn, b 6 wn]
chord_8 = chord [c 5 wn, e 4 wn]
chord_9 = chord [b 4 wn, f 1 wn]
chordList = [chord_1, chord_2, chord_3, chord_4, chord_5, chord_6, chord_7, chord_8, chord_9]
toChordProg :: Music Pitch -> Codec.Midi.Midi
toChordProg x = toMidi (perform1 (toMusic1 x)
main = runMUI (defaultMUIParams {uiSize=(300,500), uiTitle="Nonsense progression generator"}) $ proc _ -> do
mo <- selectOutput -< ()
c1 <- title "First Chord" $ withDisplay (hiSlider 1 (1, 9) 1) -< ()
c2 <- title "Second Chord" $ withDisplay (hiSlider 1 (1, 9) 1) -< ()
c3 <- title "Third Chord" $ withDisplay (hiSlider 1 (1, 9) 1) -< ()
f <- title "Frequency" $ withDisplay (hSlider (1, 10) 1) -< ()
let chordProg = let
chordSeq = let
c1' = chordList !! (c1 - 1)
c2' = chordList !! (c2 - 1)
c3' = chordList !! (c3 - 1)
in
line [c1', c2', c3']
in toChordProg chordSeq
tick <- timer -< 1.0 / f
midiOut -< (mo, fmap (const (chordProg)) tick)
Using Win 10, Cabal 3.2.0.0, ghci 8.10.1, and with Avast turned off, I get the below. Is the problem that "... (constraint from minimum version of Cabal used by Setup.hs requires >=3.2)" and mine is 3.2.0.0?
Thanks much for your help!
Microsoft Windows [Version 10.0.18362.959]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\cxlam>cabal install Euterpea
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: Euterpea-2.0.7 (user goal)
[__1] next goal: Euterpea:setup.Cabal (dependency of Euterpea)
[__1] rejecting: Euterpea:setup.Cabal-3.2.0.0/installed-3.2.0.0 (conflict:
Euterpea => Euterpea:setup.Cabal>=1.8 && <1.25)
[__1] skipping: Euterpea:setup.Cabal-3.2.0.0, Euterpea:setup.Cabal-3.0.2.0,
Euterpea:setup.Cabal-3.0.1.0, Euterpea:setup.Cabal-3.0.0.0,
Euterpea:setup.Cabal-2.4.1.0, Euterpea:setup.Cabal-2.4.0.1,
Euterpea:setup.Cabal-2.4.0.0, Euterpea:setup.Cabal-2.2.0.1,
Euterpea:setup.Cabal-2.2.0.0, Euterpea:setup.Cabal-2.0.1.1,
Euterpea:setup.Cabal-2.0.1.0, Euterpea:setup.Cabal-2.0.0.2 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=1.8 && <1.25' from 'Euterpea')
[__1] rejecting: Euterpea:setup.Cabal-1.24.2.0, Euterpea:setup.Cabal-1.24.0.0,
Euterpea:setup.Cabal-1.22.8.0, Euterpea:setup.Cabal-1.22.7.0,
Euterpea:setup.Cabal-1.22.6.0, Euterpea:setup.Cabal-1.22.5.0,
Euterpea:setup.Cabal-1.22.4.0, Euterpea:setup.Cabal-1.22.3.0,
Euterpea:setup.Cabal-1.22.2.0, Euterpea:setup.Cabal-1.22.1.1,
Euterpea:setup.Cabal-1.22.1.0, Euterpea:setup.Cabal-1.22.0.0,
Euterpea:setup.Cabal-1.20.0.4, Euterpea:setup.Cabal-1.20.0.3,
Euterpea:setup.Cabal-1.20.0.2, Euterpea:setup.Cabal-1.20.0.1,
Euterpea:setup.Cabal-1.20.0.0, Euterpea:setup.Cabal-1.18.1.7,
Euterpea:setup.Cabal-1.18.1.6, Euterpea:setup.Cabal-1.18.1.5,
Euterpea:setup.Cabal-1.18.1.4, Euterpea:setup.Cabal-1.18.1.3,
Euterpea:setup.Cabal-1.18.1.2, Euterpea:setup.Cabal-1.18.1.1,
Euterpea:setup.Cabal-1.18.1, Euterpea:setup.Cabal-1.18.0,
Euterpea:setup.Cabal-1.16.0.3, Euterpea:setup.Cabal-1.16.0.2,
Euterpea:setup.Cabal-1.16.0.1, Euterpea:setup.Cabal-1.16.0,
Euterpea:setup.Cabal-1.14.0, Euterpea:setup.Cabal-1.12.0,
Euterpea:setup.Cabal-1.10.2.0, Euterpea:setup.Cabal-1.10.1.0,
Euterpea:setup.Cabal-1.10.0.0, Euterpea:setup.Cabal-1.8.0.6,
Euterpea:setup.Cabal-1.8.0.4, Euterpea:setup.Cabal-1.8.0.2,
Euterpea:setup.Cabal-1.6.0.3, Euterpea:setup.Cabal-1.6.0.2,
Euterpea:setup.Cabal-1.6.0.1, Euterpea:setup.Cabal-1.4.0.2,
Euterpea:setup.Cabal-1.4.0.1, Euterpea:setup.Cabal-1.4.0.0,
Euterpea:setup.Cabal-1.2.4.0, Euterpea:setup.Cabal-1.2.3.0,
Euterpea:setup.Cabal-1.2.2.0, Euterpea:setup.Cabal-1.2.1,
Euterpea:setup.Cabal-1.1.6, Euterpea:setup.Cabal-1.24.1.0 (constraint from
minimum version of Cabal used by Setup.hs requires >=3.2)
[__1] fail (backjumping, conflict set: Euterpea, Euterpea:setup.Cabal)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: Euterpea:setup.Cabal, Euterpea
I'm new to Haskell and I'm making my projects on stack, so I noticed your package and some dependents aren't in the curated packages. Do you happen to know of a guide to build this package over slack? Thanks in advance.
Hi,
it would be nice to have a PhraseAttribute
for specifying a swing feel that works something like this:
data SwingDur = En | Sn | Tn
data PhraseAttribute = Dyn Dynamic
...
| Swing SwingDur Double
The double value (in range: 0.25 - 0.75
) specifies how hard the swing feel should be. E.g. Swing En 0.5
means no swing at all - straight eighths. Or e.g. Swing Sn 0.6
is a slight swing on the sixteenth notes, where the first of a pair of sixteenth notes takes 60% of the duration of an eighth note and the second takes 40%.
I have been thinking about how to implement/apply this when transforming a Music
value into a Performance
and I think it is not completely trivial.
A first attempt:
Not sure if it is this simple. There are probably a few edge cases and as always the devil lies in the detail.
However it would be great to have this feature because it can give the music a more human feel.
Trace...
Resolving dependencies...
Starting Euterpea-2.0.8
Building Euterpea-2.0.8
Failed to install Euterpea-2.0.8
Build log ( C:\Users\Admin\AppData\Local\cabal\logs\ghc-9.4.8\Euterpea-2.0.8-AzYTJppmCnXKF95rXuMISi.log ):
Preprocessing library for Euterpea-2.0.8..
Building library for Euterpea-2.0.8..
lld: error: unknown argument: -r
cabal: Leaving directory '.'
Error: cabal-3.10.2.1.exe: Some packages failed to install:
Euterpea-2.0.8-AzYTJppmCnXKF95rXuMISi failed during the building phase. The
exception was:
ExitFailure 1
This appears to be a Windows-specific issue; same versions tested worked on Mac.
Possibly relevant issue elsewhere with what looks like the same error somehow related to cabal/ghc versions on Windows although I haven't had time to dig into this yet to be sure that it really is the same thing:
haskell/cabal#8780
Best solution currently is to use a different GHC version. 8.10.5 is good, but I also had a successful build with 9.0.1.
Hey Donya,
Is there a chance this repo could be brought up to date? There's a bunch of forks that have fixes for the cabal for example so that it supports the recent ghc/cabal versions. For instance here.
Cheers!
I've been struggling getting Dyn Crescendo
and Dyn Diminuendo
working, eventually reduced down, for testing, to:
playDev 4 $ phrase [Dyn $ Diminuendo 0.5] . instrument ChoirAahs $ c 3 wn
...until I realised that this probably was working as intended - and Euterpea will never adjust the volume of a single note / chord, as they're adjusting the velocities of a stream of notes. Is that correct?
Could there be (or is there) support for these smooth dynamics - e.g. by MIDI expression sequences (discussed here at length)?
Oh and thanks for a great library 👍
I wanted to show the tree structure of a Music1
score. This can be done with https://hackage.haskell.org/package/containers-0.6.5.1/docs/Data-Tree.html#v:drawTree
Do you want to add this, or something like this, to the library? (Well, to some currently living fork, since the original seems to be frozen, cf. https://www.euterpea.com/faq/ "I want to add...")
import Euterpea
import Data.Tree
toTree :: Show a => Music a -> Tree [Char]
toTree m = case m of
Prim p -> Node (show p)[]
l :+: r -> Node "+" [toTree l, toTree r]
l :=: r -> Node "=" [toTree l, toTree r]
Modify m t -> Node (show m) [toTree t]
putStrLn $ drawTree $ toTree $ line [ c 4 en, e 4 en]
+
|
+- Note (1 % 8) (C,4)
|
`- +
|
+- Note (1 % 8) (E,4)
|
`- Rest (0 % 1)
Euterpea 2.0.4 has only been formally tested by the maintainer on Windows 10. Please report any successful builds on other operating systems here. For failed builds, please open a new issue and provide OS, ghc, an cabal version details with a copy of what happened in the terminal.
When I start ghci and do:
import Euterpea
play $ c 4 qn
I hear no sound.
I can play midi files with timidity, I've got a midi-keyboard working with jack and qsynth, so midi setup should be ok, but still no sounds and no errors.
I would like to know how to debug it...
madjestic@nu ~ $ ghci -V
The Glorious Glasgow Haskell Compilation System, version 7.10.3
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.