Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load module ‘Sound.OSC.FD’ #62

Open
joenio opened this issue May 5, 2021 · 1 comment
Open

Could not load module ‘Sound.OSC.FD’ #62

joenio opened this issue May 5, 2021 · 1 comment

Comments

@joenio
Copy link
Contributor

joenio commented May 5, 2021

./bin/tidal
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Loaded package environment from /home/joenio/.ghc/x86_64-linux-8.8.4/environments/default

<no location info>: error:
    Could not load module ‘Sound.OSC.FD’
    It is a member of the hidden package ‘hosc-0.18.1’.
    You can run ‘:set -package hosc’ to expose it.
    (Note: this unloads all the modules in the current scope.)
[TidalCycles version 1.7.4]
Installed in /home/joenio/.cabal/store/ghc-8.8.4/tidal-1.7.4-b191e933ddf23fe19ad57df4b0e91310179a72a4d8450763eda0f32225dce658/share
Listening for external controls on 127.0.0.1:6010
Connected to SuperDirt.

<interactive>:39:24: error:
    Not in scope: ‘O.time’
    No module named ‘O’ is imported.
Loaded GHCi configuration from /home/joenio/.local/share/nvim/plugged/vim-tidal/bin/../Tidal.ghci

I faced the error already related and "fixed" on issue #59 but I'm wondering if there is something that could be done on vim-tidal side to be less error-prone about this situation.

I noted that some code on Tidal.ghci file could be done to improve the plugin when that error happen instead of having to remove the whole ~/.ghci and installing everything again as very well suggested on #59.

I solved this issue not removing the ~/.ghci but replacing the tidal boot file Tidal.ghci with the tidal boot file from Atom Editor tidalcycles plugin, why I did it? Because I tested my environment with Atom + tidalcycles plugin and it works as expected without any errors, the Atom + tidalcycles plugin was tested at the same environment where vim-tidal fails.

Then I replaced the vim-tidal boot file by the atom editor boot file and everything worked well on vim-tidal with no more errors about Sound.OSC.FD.

cp .atom/packages/tidalcycles/lib/BootTidal.hs .local/share/nvim/plugged/vim-tidal/Tidal.ghci

See the diff between vim-tidal boot file and atom tidalcycles plugin boot file:

diff --git a/Tidal.ghci b/Tidal.ghci
index 1640d99..07f485c 100644
--- a/Tidal.ghci
+++ b/Tidal.ghci
@@ -2,28 +2,18 @@
 :set prompt ""
 
 import Sound.Tidal.Context
-
 import System.IO (hSetEncoding, stdout, utf8)
-
-import qualified Control.Concurrent.MVar as MV
-import qualified Sound.Tidal.Tempo as Tempo
-import qualified Sound.OSC.FD as O
-
 hSetEncoding stdout utf8
 
 -- total latency = oLatency + cFrameTimespan
 tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20})
 
 :{
-let only = (hush >>)
-    p = streamReplace tidal
+let p = streamReplace tidal
     hush = streamHush tidal
-    panic = do hush
-               once $ sound "superpanic"
     list = streamList tidal
     mute = streamMute tidal
     unmute = streamUnmute tidal
-    unmuteAll = streamUnmuteAll tidal
     solo = streamSolo tidal
     unsolo = streamUnsolo tidal
     once = streamOnce tidal
@@ -33,11 +23,6 @@ let only = (hush >>)
     all = streamAll tidal
     resetCycles = streamResetCycles tidal
     setcps = asap . cps
-    getcps = do tempo <- MV.readMVar $ sTempoMV tidal
-                return $ Tempo.cps tempo
-    getnow = do tempo <- MV.readMVar $ sTempoMV tidal
-                now <- O.time
-                return $ fromRational $ Tempo.timeToCycles tempo now
     xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i
     xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i
     histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i

Maybe there is nothing to be done then feel free to close this issue if is the case.

@Deivveed
Copy link

Deivveed commented Aug 6, 2021

```shell
./bin/tidal
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Loaded package environment from /home/joenio/.ghc/x86_64-linux-8.8.4/environments/default

<no location info>: error:
    Could not load module ‘Sound.OSC.FD’
    It is a member of the hidden package ‘hosc-0.18.1’.
    You can run ‘:set -package hosc’ to expose it.
    (Note: this unloads all the modules in the current scope.)
[TidalCycles version 1.7.4]
Installed in /home/joenio/.cabal/store/ghc-8.8.4/tidal-1.7.4-b191e933ddf23fe19ad57df4b0e91310179a72a4d8450763eda0f32225dce658/share
Listening for external controls on 127.0.0.1:6010
Connected to SuperDirt.

<interactive>:39:24: error:
    Not in scope: ‘O.time’
    No module named ‘O’ is imported.
Loaded GHCi configuration from /home/joenio/.local/share/nvim/plugged/vim-tidal/bin/../Tidal.ghci

I faced the error already related and "fixed" on issue #59 but I'm wondering if there is something that could be done on vim-tidal side to be less error-prone about this situation.
I noted that some code on Tidal.ghci file could be done to improve the plugin when that error happen instead of having to remove the whole ~/.ghci and installing everything again as very well suggested on #59.
I solved this issue not removing the ~/.ghci but replacing the tidal boot file Tidal.ghci with the tidal boot file from Atom Editor tidalcycles plugin, why I did it? Because I tested my environment with Atom + tidalcycles plugin and it works as expected without any errors, the Atom + tidalcycles plugin was tested at the same environment where vim-tidal fails.
Then I replaced the vim-tidal boot file by the atom editor boot file and everything worked well on vim-tidal with no more errors about Sound.OSC.FD.

cp .atom/packages/tidalcycles/lib/BootTidal.hs .local/share/nvim/plugged/vim-tidal/Tidal.ghci

See the diff between vim-tidal boot file and atom tidalcycles plugin boot file:

diff --git a/Tidal.ghci b/Tidal.ghci
index 1640d99..07f485c 100644
--- a/Tidal.ghci
+++ b/Tidal.ghci
@@ -2,28 +2,18 @@
 :set prompt ""
 
 import Sound.Tidal.Context
-
 import System.IO (hSetEncoding, stdout, utf8)
-
-import qualified Control.Concurrent.MVar as MV
-import qualified Sound.Tidal.Tempo as Tempo
-import qualified Sound.OSC.FD as O
-
 hSetEncoding stdout utf8
 
 -- total latency = oLatency + cFrameTimespan
 tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20})
 
 :{
-let only = (hush >>)
-    p = streamReplace tidal
+let p = streamReplace tidal
     hush = streamHush tidal
-    panic = do hush
-               once $ sound "superpanic"
     list = streamList tidal
     mute = streamMute tidal
     unmute = streamUnmute tidal
-    unmuteAll = streamUnmuteAll tidal
     solo = streamSolo tidal
     unsolo = streamUnsolo tidal
     once = streamOnce tidal
@@ -33,11 +23,6 @@ let only = (hush >>)
     all = streamAll tidal
     resetCycles = streamResetCycles tidal
     setcps = asap . cps
-    getcps = do tempo <- MV.readMVar $ sTempoMV tidal
-                return $ Tempo.cps tempo
-    getnow = do tempo <- MV.readMVar $ sTempoMV tidal
-                now <- O.time
-                return $ fromRational $ Tempo.timeToCycles tempo now
     xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i
     xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i
     histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i

Maybe there is nothing to be done then feel free to close this issue if is the case.

Had the same issue, this solution worked for me. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants