[racket-users] raco pkg downloads source code with a future timestamp

2018-03-29 Thread Greg Trzeciak
This is a continuation of the previous 
thread: https://groups.google.com/forum/#!topic/racket-users/kYk-x5Zn5EE 
the title of this one is more appropriate to the problem.

On my Windows 10 machine all packages are downloaded and the files are 
timestamped +1h or +2h into the future (in 
 "...\Roaming\Racket\6.12\pkgs"). This makes it impossible to compile newly 
downloaded packages. As a current hack I run individually "raco setup" 
after few hours have passed on new package and its downloaded dependencies.

Here are some tests and observations
* The problem doesn't appear outside of raco pkg (ie: git clone uses 
correct dates, writing files from racket - also correct)
* cache file for downloaded content is correctly timestamped
* package folders are correctly timestamped
* files inside of those folders have timestamp +1h or sometimes +2h into 
the future
* "racket -l- net/git-checkout --git github.com me/my-repo e:\test1" 
downloads the files with correct timestamp

Feedback and help from anyone knowing a bit more on inner working of raco 
pkg is welcome.

G,







-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] raco pkg downloads source code with a future timestamp

2018-03-29 Thread Matthew Flatt
At Thu, 29 Mar 2018 04:09:00 -0700 (PDT), Greg Trzeciak wrote:
> Here are some tests and observations
> * The problem doesn't appear outside of raco pkg (ie: git clone uses 
> correct dates, writing files from racket - also correct)
> * cache file for downloaded content is correctly timestamped
> * package folders are correctly timestamped
> * files inside of those folders have timestamp +1h or sometimes +2h into 
> the future

Thanks for working to narrow this down!

It sounds like the problem might be related to the ".tgz" unpacker. If
you use `file/untgz` to unpack the cache file for download content,
does that produce the wrong timestamp on unpacked files?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] raco pkg downloads source code with a future timestamp

2018-03-29 Thread Greg Trzeciak
You are right - sample cached file I tried has a timestamp of 12:50 while 
unpacked files frome cached are all with timestamp 13:50


On Thursday, March 29, 2018 at 1:29:11 PM UTC+2, Matthew Flatt wrote:
>
> At Thu, 29 Mar 2018 04:09:00 -0700 (PDT), Greg Trzeciak wrote: 
> > Here are some tests and observations 
> > * The problem doesn't appear outside of raco pkg (ie: git clone uses 
> > correct dates, writing files from racket - also correct) 
> > * cache file for downloaded content is correctly timestamped 
> > * package folders are correctly timestamped 
> > * files inside of those folders have timestamp +1h or sometimes +2h into 
> > the future 
>
> Thanks for working to narrow this down! 
>
> It sounds like the problem might be related to the ".tgz" unpacker. If 
> you use `file/untgz` to unpack the cache file for download content, 
> does that produce the wrong timestamp on unpacked files? 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] raco pkg downloads source code with a future timestamp

2018-03-29 Thread Matthew Flatt
How about a direct use of `file-or-directory-modify-seconds`? Does

 (file-or-directory-modify-seconds "test-file" (current-seconds))

on an existing "test-file" set the timestamp on "test-file" to the
current time?

At Thu, 29 Mar 2018 04:38:23 -0700 (PDT), Greg Trzeciak wrote:
> You are right - sample cached file I tried has a timestamp of 12:50 while 
> unpacked files frome cached are all with timestamp 13:50
> 
> 
> On Thursday, March 29, 2018 at 1:29:11 PM UTC+2, Matthew Flatt wrote:
> >
> > At Thu, 29 Mar 2018 04:09:00 -0700 (PDT), Greg Trzeciak wrote: 
> > > Here are some tests and observations 
> > > * The problem doesn't appear outside of raco pkg (ie: git clone uses 
> > > correct dates, writing files from racket - also correct) 
> > > * cache file for downloaded content is correctly timestamped 
> > > * package folders are correctly timestamped 
> > > * files inside of those folders have timestamp +1h or sometimes +2h into 
> > > the future 
> >
> > Thanks for working to narrow this down! 
> >
> > It sounds like the problem might be related to the ".tgz" unpacker. If 
> > you use `file/untgz` to unpack the cache file for download content, 
> > does that produce the wrong timestamp on unpacked files? 
> >
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] raco pkg downloads source code with a future timestamp

2018-03-29 Thread Greg Trzeciak
The time set by it is correct (current)

On Thursday, March 29, 2018 at 1:55:19 PM UTC+2, Matthew Flatt wrote:
>
> How about a direct use of `file-or-directory-modify-seconds`? Does 
>
>  (file-or-directory-modify-seconds "test-file" (current-seconds)) 
>
> on an existing "test-file" set the timestamp on "test-file" to the 
> current time? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Contract work

2018-03-29 Thread James Platt
My company, Biomantica, is working on an SBIR grant application and we would 
like to be able to include statements from people who would be willing to do 
Racket contract work for us contingent on our getting the grant.  What we 
really need is just to show that we have people we can call on who have 
expertise we will need.  This is done with a form which the NIH calls a 
"bioisketch."  It's like a resume or CV but shorter (just a few paragraphs) and 
the really important part is a paragraph explaining what skills you have to 
contribute to this specific project.  

To be clear, this is not near-term.  The grant comes in two phases, and it will 
be December before we know if we're getting Phase 1.  Unfortunately the grant 
deadline is now a week away, so sorry for the short notice, but who is 
interested and what skills (below) can you provide?

Please note that we won't know if we're getting the grant until the end of the 
year, so sending us your biosketch does not commit you to anything and you will 
have plenty of time to make arrangements when the time comes. 

Note that we will also want to hire full time Racket programmers as regular 
employees if we get Phase II of the grant.  People who send us biosketches now 
will be at the head of the line then.

The initial product is something which behaves like Dropbox but is actually a 
P2P network so you can get accelerated data transfer and your file space is 
only limited by the storage (hard drives) you contribute to the network.  We 
will then add features for data analytics, real-time conferencing, and 
distributed computation.


Things involved in our product, and therefore things we will be hiring for:

FFI from Racket to various C libraries which might include PJSIP, libnice,  and 
libsodium, for example.

PKI with both a CA and WoT which reinforce each other for TLS, digital signing 
of files, and authentication of users that are part of a collaborative group to 
us and to each other.

NAT traversal, including PCP, NAT-PMP, uPnP, STUN, TURN, and ICE.

Various optimizations of data transfer using TCP/IP, UDP, UDT, and uTP, IPv4, 
and IPv6. 

Optimizations of data transfer based on predictions of its likely destinations 
from relationships in the WoT and network performance metrics.

cryptocurrency, especially the Etherium Virtual Machine.

Fountain codes.

GUI work, especially for managing collaborative groups of people, sort of 
social networking style, but actually supporting our WoT.

Protocol buffers and database work to exchange metadata with other systems such 
as the Galaxy open source bioinformatics platform.

Although I have the CISSP credential, we could still use more depth in 
information security.

Did I mention information security?

If you actually understand what we're talking about (above), you're probably 
someone we can use.  :)

James

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Why is there a space in the path to the Racket application on MacOSX?

2018-03-29 Thread Stephen Smith
Authoring a new Racket book (targeting all platforms and non-programmers) 
and having to tell users to quote paths with spaces to be able to use the 
command-line tools seems distracting and an unnecessary complexity to 
impose on them.

Reference this post: 
https://groups.google.com/d/msg/racket-users/2-ASoQ03x9Q/AXQyV4MTx0EJ by 
Matthew Johnson.

>From a *nix perspective, it just seems like 'bad practice' to have folder 
names with spaces? Though, devil's advocate, I get that underscores or 
combined words can be unsightly, especially on a Mac where there are 
hard-core design people to contend with (I can hear them now, "It doesn't 
look nice in Finder" :-) but for Mac apps that have command-line tools it 
seems more common to not have spaces in the folder name leading to a bin 
folder.

Is there a particular reason why Racket uses a space in its folder name?

Cheers,
Stephen



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Why is there a space in the path to the Racket application on MacOSX?

2018-03-29 Thread David Storrs
Second the desire for this not to be the case.  Personally, my
solution is just to rename the folder after installing it.  I am
currently working with binaries from
/Applications/Racket_v6.11/bin/...

On Thu, Mar 29, 2018 at 3:51 PM, Stephen Smith
 wrote:
> Authoring a new Racket book (targeting all platforms and non-programmers)
> and having to tell users to quote paths with spaces to be able to use the
> command-line tools seems distracting and an unnecessary complexity to impose
> on them.
>
> Reference this post:
> https://groups.google.com/d/msg/racket-users/2-ASoQ03x9Q/AXQyV4MTx0EJ by
> Matthew Johnson.
>
> From a *nix perspective, it just seems like 'bad practice' to have folder
> names with spaces? Though, devil's advocate, I get that underscores or
> combined words can be unsightly, especially on a Mac where there are
> hard-core design people to contend with (I can hear them now, "It doesn't
> look nice in Finder" :-) but for Mac apps that have command-line tools it
> seems more common to not have spaces in the folder name leading to a bin
> folder.
>
> Is there a particular reason why Racket uses a space in its folder name?
>
> Cheers,
> Stephen
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Why is there a space in the path to the Racket application on MacOSX?

2018-03-29 Thread Eric Eide
David Storrs  writes:

> Second the desire for this not to be the case.  Personally, my
> solution is just to rename the folder after installing it.  I am
> currently working with binaries from
> /Applications/Racket_v6.11/bin/...

FWIW, I make a symlink (with no spaces in the name) and always use that in my
config files, scripts, etc.

Bonus: When I update the installation, I just recreate the symlink and point it
at the newly installed software.

(PS --- I don't like the spaces in the name, either!)

-- 
---
Eric Eide   . University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Mozart's Musical dice with rsound

2018-03-29 Thread Daniel Prager
For fun, I've written a program to synthesise random compositions based on
Mozart's musical dice procedure, with results played courtesy of rsound.
[Program appended.]

See this Daily Programmer challenge for background:

https://www.reddit.com/r/dailyprogrammer/comments/7i1ib1/20171206_challenge_343_intermediate_mozarts/


*Areas for improvement *

1. There is an unpleasant quality to the ends of the notes, which I
generate by naively clipping piano-tones. Furthermore, if I up the tempo
(e.g. set BEAT-LENGTH to 1/4) it becomes unlistenable. What's a better way
to truncate the notes?

2. I assembled the piece by appending measures and then playing the result.
What's the recommended way to reduce memory and start playing faster using
(say) pstream?

Dan


#lang racket

(require racket/random
 rsound
 rsound/piano-tones
 net/url)

(define BEAT-LENGTH 1/2)

(define base-composition-url (string->url "
https://gist.githubusercontent.com/cosmologicon/708fefa9793753ed4f075aaf781f3d67/raw/f08364a6056691215b99f705b4836f3d131ff6eb/mozart-dice-starting.txt
"))

(define (string->midi s)
  (let* ([note (string->symbol (substring s 0 1))]
 [sharp (if (string-contains? s "#") 1 0)]
 [octave (string->number (substring s (+ 1 sharp)))])
(+ (match note ['C 0] ['D 2] ['E 4] ['F 5] ['G 7] ['A 9] ['B 11])
   sharp
   (* 12 (+ octave 1)

(define base-composition
  (for/list ([line (string-split
(port->string
 (get-pure-port base-composition-url))
"\n")])
(define items (string-split line " "))
(cons (first items) (map string->number (rest items)

(define (note->piano n d)
  (clip (piano-tone (string->midi n)) 0 (exact-round (* FRAME-RATE d 1/2

(define (in-measure note measure)
  (match-define (list _ start duration) note)
  (<= (* 3 measure) start (+ start duration) (* 3 (+ measure 1

(define (measure n)
  (for/list ([note base-composition] #:when (in-measure note n)
 #:break (in-measure note (+ 1 n)))
(match-define (list tone start duration) note)
(list tone (- start (* n 3)) duration)))

(define (measure->sound n)
  (rs-overlay*
   (for/list ([note (measure n)])
 (rs-append (silence (+ 1 (exact-round (* BEAT-LENGTH FRAME-RATE
(second note)
(note->piano (first note) (last note))

(define preferred-measures
  '((96 32 69 40 148 104 152 119 98 3 54)
(22 6 95 17 74 157 60 84 142 87 130)
(141 128 158 113 163 27 171 114 42 165 10)
(41 63 13 85 45 167 53 50 156 61 103)
(105 146 153 161 80 154 99 140 75 135 28)
(122 46 55 2 97 68 133 86 129 47 37)
(11 134 110 159 36 118 21 169 62 147 106)
(30 81 24 100 107 91 127 94 123 33 5)
(70 117 66 90 25 138 16 120 65 102 35)
(121 39 136 176 143 71 155 88 77 4 20)
(26 126 15 7 64 150 57 48 19 31 108)
(9 56 132 34 125 29 175 166 82 164 92)
(112 174 73 67 76 101 43 51 137 144 12)
(49 18 58 160 136 162 168 115 38 59 124)
(109 116 145 52 1 23 89 72 149 173 44)
(14 83 79 170 93 151 172 111 8 78 131)))

(define (musical-dice)
  (for/list ([m preferred-measures])
(list-ref m (+ (random 6) (random 6)

(play
 (rs-append*
  (for/list ([i (musical-dice)])
(display (~a i ": "))
(displayln (measure (- i 1)))
(measure->sound (- i 1)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Why is there a space in the path to the Racket application on MacOSX?

2018-03-29 Thread HiPhish
I think you are trying to solve the wrong problem. If people want to use a 
command-line tool they should know how to use the command line first. They 
don't have to know every arcane feature of the Bourne Shell, but knowing to 
escape spaces or quote strings is the bare minimum. Think about it like 
this: if you are trying to give someone directions you already assume they 
know how to drive a car, right? If you want to write a book on Racket, then 
focus on Racket. And if they cannot use the command-line they can still use 
the GUI tools.

On Thursday, March 29, 2018 at 9:51:07 PM UTC+2, Stephen Smith wrote:
>
> Authoring a new Racket book (targeting all platforms and non-programmers) 
> and having to tell users to quote paths with spaces to be able to use the 
> command-line tools seems distracting and an unnecessary complexity to 
> impose on them.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Fwd: [racket-users] Mozart's Musical dice with rsound

2018-03-29 Thread 'John Clements' via Racket Users
Oops forgot to cc: users. Dan, if you respond, could you respond to this one 
rather than the one I sent only to you? Sorry.

John

> Begin forwarded message:
> 
> From: John Clements 
> Subject: Re: [racket-users] Mozart's Musical dice with rsound
> Date: March 29, 2018 at 15:24:11 PDT
> To: Daniel Prager 
> 
> 
> 
>> On Mar 29, 2018, at 14:40, Daniel Prager  wrote:
>> 
>> For fun, I've written a program to synthesise random compositions based on 
>> Mozart's musical dice procedure, with results played courtesy of rsound. 
>> [Program appended.]
>> 
>> See this Daily Programmer challenge for background:
>> 
>> https://www.reddit.com/r/dailyprogrammer/comments/7i1ib1/20171206_challenge_343_intermediate_mozarts/
>> 
>> 
>> Areas for improvement 
>> 
>> 1. There is an unpleasant quality to the ends of the notes, which I generate 
>> by naively clipping piano-tones. Furthermore, if I up the tempo (e.g. set 
>> BEAT-LENGTH to 1/4) it becomes unlistenable. What's a better way to truncate 
>> the notes?
> 
> Check out the “envelope” functions. I think you’re looking for something like 
> this:
> 
> ```
> #lang racket
> 
> (require rsound
> rsound/envelope)
> 
> (play
> 
> (rs-mult
>  (make-tone 500 0.7 48000)
>  ((adsr 2 1.0 2 1.0 24000) 48000)))
> ```
> 
> The adsr function is undocumented. Let me know if you want me to document it.
> 
>> 
>> 2. I assembled the piece by appending measures and then playing the result. 
>> What's the recommended way to reduce memory and start playing faster using 
>> (say) pstream?
> 
> 
> Something like this:
> 
> ```
> #lang racket
> 
> (require rsound
> rsound/envelope
> rsound/piano-tones)
> 
> (define FR 48000)
> (define bpm 120)
> (define qtr-len (round (* FR (/ 60 bpm) 1)))
> (define eighth-len (round (* FR (/ 60 bpm) 1/2)))
> 
> (define notes
>  '((0 60)
>(1 62)
>(2 64)
>(3 65)
>(4 62)
>(5 64)
>(6 60)))
> 
> (define ps (make-pstream))
> 
> (define delay (* FR 1))
> 
> (for ([n (in-list notes)])
>  (pstream-queue ps
> (piano-tone (second n))
> (+ delay (* (first n) eighth-len
> ```
> 
> Note that since the pstream starts its internal clock immediately, queueing 
> things to play without a delay will be a problem; by the time the piano-tone 
> is computed, you’re queueing it in the past. A delay of a second is fine on 
> my machine, but it might not be on a different one.
> 
> Also, the piano notes are hashed on construction, so you could “warm up” the 
> generator by pre-generating each pitch you want to use.
> 
> Finally, the piano note generation could be a lot faster; it’s not really 
> optimized at all.
> 
> Best,
> 
> John
> 
> 
>> 
>> Dan
>> 
>> 
>> #lang racket
>> 
>> (require racket/random
>> rsound
>> rsound/piano-tones
>> net/url)
>> 
>> (define BEAT-LENGTH 1/2)
>> 
>> (define base-composition-url (string->url 
>> "https://gist.githubusercontent.com/cosmologicon/708fefa9793753ed4f075aaf781f3d67/raw/f08364a6056691215b99f705b4836f3d131ff6eb/mozart-dice-starting.txt";))
>> 
>> (define (string->midi s)
>>  (let* ([note (string->symbol (substring s 0 1))]
>> [sharp (if (string-contains? s "#") 1 0)]
>> [octave (string->number (substring s (+ 1 sharp)))])
>>(+ (match note ['C 0] ['D 2] ['E 4] ['F 5] ['G 7] ['A 9] ['B 11])
>>   sharp
>>   (* 12 (+ octave 1)
>> 
>> (define base-composition
>>  (for/list ([line (string-split
>>(port->string
>> (get-pure-port base-composition-url))
>>"\n")])
>>(define items (string-split line " "))
>>(cons (first items) (map string->number (rest items)
>> 
>> (define (note->piano n d)
>>  (clip (piano-tone (string->midi n)) 0 (exact-round (* FRAME-RATE d 1/2
>> 
>> (define (in-measure note measure)
>>  (match-define (list _ start duration) note)
>>  (<= (* 3 measure) start (+ start duration) (* 3 (+ measure 1
>> 
>> (define (measure n)
>>  (for/list ([note base-composition] #:when (in-measure note n)
>> #:break (in-measure note (+ 1 n)))
>>(match-define (list tone start duration) note)
>>(list tone (- start (* n 3)) duration)))
>> 
>> (define (measure->sound n)
>>  (rs-overlay*
>>   (for/list ([note (measure n)])
>> (rs-append (silence (+ 1 (exact-round (* BEAT-LENGTH FRAME-RATE (second 
>> note)
>>(note->piano (first note) (last note))
>> 
>> (define preferred-measures
>>  '((96 32 69 40 148 104 152 119 98 3 54)
>>(22 6 95 17 74 157 60 84 142 87 130)
>>(141 128 158 113 163 27 171 114 42 165 10)
>>(41 63 13 85 45 167 53 50 156 61 103)
>>(105 146 153 161 80 154 99 140 75 135 28)
>>(122 46 55 2 97 68 133 86 129 47 37)
>>(11 134 110 159 36 118 21 169 62 147 106)
>>(30 81 24 100 107 91 127 94 123 33 5)
>>(70 117 66 90 25 138 16 120 65 102 35)
>>(121 39 136 176 143 71 155 88 77 4 20)
>>(26 126 15 7 64 150 57 48 19 31 1

Re: [racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-29 Thread Sanjeev Sharma
Thanks so much Mr. Williams.

I posted that last item then disappeared - I had one of my CPA exams (I
failed, but i always think that after an exam) & just had to force myself
not to check my email for a couple of days.

I hope it didn't take you too long.

Unless, like me, you program like some people play video games.  If so, I
hope it kept you up all night ; )


On Tue, Mar 27, 2018 at 11:23 AM, Doug Williams <
m.douglas.willi...@gmail.com> wrote:

> Sanjeev and I took this discussion offline to iterate over some details.
> But, I thought I would post some final thoughts on this. First, I want to
> thank Sanjeev for his original post. Without it, I wouldn't have dived into
> some of these details - particularly creating the animated gif.
>
> One issue that came up was that the default line-samples parameter value
> of 500 doesn't work well for larger plots - those with 'longer' lines. So,
> you may need to up this value - we used 5000 for the following example by
> using (parameterize ((line-samples 5000)) ...) around the appropriate code.
> Other than that, this seems to work fine.
>
> I am attaching the code to animate another of Sanjeev's examples - both
> without and with the code to create an animated gif. I am also appending
> the resulting gif. This was a lot of fun.
>
> Doug
>
> On Mon, Mar 26, 2018 at 8:49 AM, Doug Williams <
> m.douglas.willi...@gmail.com> wrote:
>
>> And, I made a gif of the animated 3D plot.
>>
>> On Mon, Mar 26, 2018 at 8:42 AM, Doug Williams <
>> m.douglas.willi...@gmail.com> wrote:
>>
>>> I hit send a bit too fast. Here is the code (from the animate-canvas
>>> package on PLaneT) for the 3D animation.
>>>
>>> On Mon, Mar 26, 2018 at 8:39 AM, Doug Williams <
>>> m.douglas.willi...@gmail.com> wrote:
>>>
 Another thing I like to do is to animate such plots. The plot package
 is (generally) fast enough to do this. This code uses my animated-canvas%
 package, which is still on planet. I've also attached a gif of it. [I had
 never used the animated gif routines in Racket before, but they were pretty
 easy to use.] I've also attached an an animation of one of the 3D plots
 from the plot manual.

 animation.rkt - Sanjeev's plot animated
 animation.gif - the animated gif (so you don't actually have to run the
 code to see the results)


 On Fri, Mar 23, 2018 at 3:17 PM, Sanjeev Sharma 
 wrote:

> I've done no math in 20 years - used to do tons (with the not so great
> graphics of the time) saw this intriguing plot & banged my head against a
> wall for a couple of hours.
>
> Then I just settled down & read the manual systematically, pretending
> it may have some info,  followed the examples and voila
>
> (require plot)(plot-new-window? #t)
> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Why is there a space in the path to the Racket application on MacOSX?

2018-03-29 Thread JCG
Count me in as a person who renames racket installations without spaces.

It is more prudent to design file names without special characters, 
escapes, or quotes.  Otherwise, any shell script that might otherwise work 
on most unix file names may fail.  It's just not worth the hassle guessing 
if all of a system's scripts will be compatible.  As an example, AWK 
scripts used in a pipe are quite susceptible to surprise when one field 
appears as two.  Ditto for 'sort +k ...'.   

A further reason to eschew spaces in file name is documentation.   Having a 
space in a file name within prose is quite likely going to suffer a 
confusing line split. 

Thanks,
JG

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] raco pkg downloads source code with a future timestamp

2018-03-29 Thread Matthew Flatt
[Back on-list]

At Thu, 29 Mar 2018 17:33:10 +0200, Grzegorz Trzeciak wrote:
> *** So it seems the problem is when reading the file timestamp with
> `file-or-directory-modify-seconds` <- it's always wrong on my PC***

I didn't figure out exactly why the conversion of filesystem time to
seconds was going wrong, but after that wrong code was written, a
better relevant calculation has been implemented for `seconds->date`.
I've pushed a repair that seems to work when I set my timezone to CEDT.

Thanks for tracking down the problem!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Mozart's Musical dice with rsound

2018-03-29 Thread Daniel Prager
Thanks John

I've made updates (below) based on your suggestions, and the overall effect
is pleasing.


1. The use of asdr fixed the choppiness, although I don't really understand
what I'm doing. [I understand that asdr stands for
Attack-Decay-Sustain-Release

.]

It's unclear to me why I still need to clip, and some documentation would
indeed be welcome.

(define (note->piano n d)
  (define len (tone-length d))
  (clip
   (rs-mult
(piano-tone (string->midi n))
((adsr 2 1.0 2 1.0 (exact-round (* 1/2 len))) len))
   0 len))

2. On my 2012 Mac the streamed version (stream-mozart) is crackly early on,
until the processing finishes.

3. More trivially I added a beats-per-minute parameter.


Finally, I look forward to someone adding some visualisation
!


Dan


#lang racket

(require racket/random
 rsound
 rsound/piano-tones
 rsound/envelope
 net/url)

(define bpm 180) ; presto

(define base-composition-url (string->url "
https://gist.githubusercontent.com/cosmologicon/708fefa9793753ed4f075aaf781f3d67/raw/f08364a6056691215b99f705b4836f3d131ff6eb/mozart-dice-starting.txt
"))

(define (string->midi s)
  (let* ([note (string->symbol (substring s 0 1))]
 [sharp (if (string-contains? s "#") 1 0)]
 [octave (string->number (substring s (+ 1 sharp)))])
(+ (match note ['C 0] ['D 2] ['E 4] ['F 5] ['G 7] ['A 9] ['B 11])
   sharp
   (* 12 (+ octave 1)

(define base-composition
  (for/list ([line (string-split
(port->string
 (get-pure-port base-composition-url))
"\n")])
(define items (string-split line " "))
(cons (first items) (map string->number (rest items)

(define (tone-length d)
  (exact-round (/ (* FRAME-RATE 60 d) bpm)))

(define (note->piano n d)
  (define len (tone-length d))
  (clip
   (rs-mult
(piano-tone (string->midi n))
((adsr 2 1.0 2 1.0 (exact-round (* 1/2 len))) len))
   0 len))

(define (in-measure note measure)
  (match-define (list _ start duration) note)
  (<= (* 3 measure) start (+ start duration) (* 3 (+ measure 1

(define (measure n)
  (for/list ([note base-composition] #:when (in-measure note n)
 #:break (in-measure note (+ 1 n)))
(match-define (list tone start duration) note)
(list tone (- start (* n 3)) duration)))

(define (measure->sound n)
  (rs-overlay*
   (for/list ([note (measure n)])
 (rs-append (silence (+ 1 (tone-length (second note
(note->piano (first note) (last note))

(define preferred-measures
  '((96 32 69 40 148 104 152 119 98 3 54)
(22 6 95 17 74 157 60 84 142 87 130)
(141 128 158 113 163 27 171 114 42 165 10)
(41 63 13 85 45 167 53 50 156 61 103)
(105 146 153 161 80 154 99 140 75 135 28)
(122 46 55 2 97 68 133 86 129 47 37)
(11 134 110 159 36 118 21 169 62 147 106)
(30 81 24 100 107 91 127 94 123 33 5)
(70 117 66 90 25 138 16 120 65 102 35)
(121 39 136 176 143 71 155 88 77 4 20)
(26 126 15 7 64 150 57 48 19 31 108)
(9 56 132 34 125 29 175 166 82 164 92)
(112 174 73 67 76 101 43 51 137 144 12)
(49 18 58 160 136 162 168 115 38 59 124)
(109 116 145 52 1 23 89 72 149 173 44)
(14 83 79 170 93 151 172 111 8 78 131)))

(define measure-length (tone-length 3))

(define (musical-dice)
  (for/list ([m preferred-measures])
(list-ref m (+ (random 6) (random 6)


(define (play-mozart)
  (play
   (rs-append*
(for/list ([i (musical-dice)]
   [d (in-naturals)])
  (display (~a (+ 1 d) ". " i ": "))
  (displayln (measure (- i 1)))
  (measure->sound (- i 1))

(define (stream-mozart)
  (define ps (make-pstream))
  (for ([i (musical-dice)]
[d (in-naturals)])
(display (~a (+ 1 d) ". " i ": "))
(displayln (measure (- i 1)))
(pstream-queue ps
   (measure->sound (- i 1))
   (* (+ d 1) measure-length

(play-mozart)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.