freenode/#lisp - IRC Chatlog
Search
15:11:44
phoe_
Xach: I have one question. CL-LZMA has a very small test suite that verifies that the foreign library was imported successfully and works. Is there any article on how that test suite should be invoked?
16:17:04
sjl
Shinmera: I didn't have time to figure out the buffering thing for the jam, but I still intend to do it at some point
16:17:34
sjl
Shinmera: I decided to try making something simpler first, to try to get my head around all the moving parts in Harmony, so I tried making a sine generator source
16:55:20
sjl_
Shinmera: I was also confused about a couple of things. Like the CHANNELS argument to MAKE-CHANNEL.
17:00:07
Shinmera
sjl: Okey, so, for your example you probably don't want to use a source as the superclass, since sources run a source->buffer translation step after the raw data is decoded.
17:00:39
Shinmera
sjl: The reason why sources have a channels argument is because they handle the translation from a single sound sample array to one buffer per channel.
17:01:25
Shinmera
sjl: But since you only have one channel and your data is already floats, the decoding step is unnecessary and you could instead directly write into a buffer.
17:02:39
Shinmera
sjl: I guess the confusing part is the name "source". A source, in libmixed terms, is a segment that decodes a single array of encoded audio data into one or more buffers of floats.
17:03:37
Shinmera
But in this case it doesn't make much sense to do so, since a segment works just as well.
17:05:35
sjl
I guess that answers my other question: what to do with the buffer make-channel created, which I don't think I need
17:05:46
Shinmera
Well, it doesn't really decode either, it's more of a "destructuring" or "normalising"
17:06:23
Shinmera
I don't think anyone really uses this yet, and if so at the point where the name change would screw things up.
17:07:05
Shinmera
cl-mixed has an example for a custom segment with the logic implemented in lisp: https://github.com/Shirakumo/cl-mixed/blob/master/test.lisp#L127
17:09:03
sjl
so in my case, it would be implemented something like (setf (pos source) (* time-per-sample position))
17:09:03
Shinmera
The SEEK function handles the logic for translating seconds to sample index though, so all you need to implement is seek-to-sample that resets the input to a specified sample index (if applicable)
17:09:24
Shinmera
Well in your case, since a sine wave is inaudibly contiguous, you could just not do anything.
17:10:36
Shinmera
Anyway, I feel really horrid at explaining this all in roundabout ways and feel like if I implemented a simple 'source' to demonstrate how things should work would make things much clearer.
17:11:57
sjl
and even if I primarily want to use the top layer (harmony)I need to understand the next one at least
17:12:49
Shinmera
FWIW here's how libmixed implements the sine source: https://github.com/Shirakumo/libmixed/blob/master/src/segments/generator.c
17:13:31
Shinmera
the essence is just this https://github.com/Shirakumo/libmixed/blob/master/src/segments/generator.c#L56
17:14:08
Shinmera
But yeah. I'll throw together some examples tomorrow to hopefully clear things up.
17:14:18
sjl
yeah, I've done something like that with portaudio https://github.com/sjl/cl-chip8/blob/master/src/emulator.lisp#L331-L430
18:03:52
Xach
I guess I need to make it really easty to run outside of quicklisp dist construction like, right away.
18:15:14
akem
what slime contribs do ppl usually include? I have the slime-fancy one by default, but I noticed that this doens't include slime-cl-indent
18:25:01
Xach
Ah yes, there are problems with bare $0 and the path, now I remember. But it should work for the documented case anyway.
19:18:12
cgay
ob lisp: I was surprised today to rediscover that z must be positive (loop from x downto y by z ...) since it seems natural to say "by -1" there.
19:19:45
cgay
Sure. I can see that once you have decided to have "downto" in the language you could arrive at that decision legitimately. :)
19:19:50
z3t0
I can get the basic-window example to run as per the instructions, but cannot get it to run if I try copy pasting the example code into my own
19:30:18
lambdice
do you know if the result of type-of is consistent over all the implementation of common lisp ?
19:32:01
lambdice
Shinmera: in fact i am having fun with a little tool for serializing different object, vector, hash-table etc
19:35:30
pjb
lambdice: there are constraints on the types and their subtype relationships, but some subtypes may be equal to their supertype, or the implementation may have additionnal types in the middle. Testing (subtypep (type-of x) some-type) or (typep x some-type) will give more consistent results.
19:39:22
pjb
Yes, but float has 4 subtypes: short-float single-float double-float and long-float. Some implementations have the four subtypes distinct. In some other implementations, short-float = single-float and double-float=long-float. There are constraints on what subtype may be equal to what other.
19:40:09
pjb
Another example, the type character has two distinct subtypes base-char and extended-char. But in some implementation base-char = character, and extended-char = nil.
19:40:37
Shinmera
I think it's even allowed for type-of to return something other than symbols and conses as long as you can do typep and subtypep with the returned type.
19:42:08
pjb
Also, when you consider type-of, implementations may be moreor less specific. eg. (type-of 1) returns BIT or (INTEGER 1 1)…
19:44:24
Shinmera
lambdice: My point is also that the type returned might not even be readably printable.
19:45:21
pjb
clhs 4.2.3 says Type specifiers can be symbols, classes, or lists. so I guess Shinmera is right, #<class foo> could be the result of (type-of (make-instance 'foo)) Perhaps it may occur when the class is anonymous.
19:45:51
lambdice
Shinmera: indeed, pjb point on testing the type with subtypep on something more general
19:45:53
pjb
clhs 4.2.3 says also: A class object can be used as a type specifier. When used this way, it denotes the set of all members of that class.
19:49:13
pjb
But you need to add the variants, such when base-char = character, or short-float=single-float, etc.
20:15:10
rumbler31
so i've wondered, while the graph of types is nice, what do people really use it for?
20:25:07
pjb
rumbler31: to know that you can call the function (defun f (x y) (+ x y)) with as arguments any pair of numbers, including fixnums. Or complexes.
20:44:20
jasom
Xach: I seem to recall someone saying that it wasn't quite a lattice due to certain array type rules?
22:10:04
vsync
this may already be documented but why does ASDF have (ASDF:LOAD-OP op ...) rather than (op ...)?
22:16:20
Shinmera
oos stands for "operate on system" and will construct the operation object for you, then compute a plan for said operation on the given component, and finally execute it.
22:16:59
Shinmera
Because PERFORM is a method that uses multiple-dispatch so you can specify on component, operation, or both.
22:17:25
Shinmera
So making a method for each operation instead, aside from not allowing you to associate data with the operation, would be less flexible.
22:18:15
Shinmera
Invoking the MOP and other such things is not exactly a great idea for something that should work on every implementation seamlessly.
22:18:55
vsync
or, "you have a problem and decided to use metaprogramming... now you have a problem-factory-factory" take your pick :)
22:20:31
vsync
and yes, I think I've just bought in to redoing my design to eschew gratuitous metaclasses
22:21:16
vsync
though I still feel like slots on the metaobject class are conceptually cleaner than :allocation class on the instance class
22:21:47
vsync
but the key seems to be taking a step back and figuring out my protocol before the modeling... it feels like the answers will naturally come forth
22:23:12
vsync
I always go for interface-first... protocol classes with more detailed subclasses seems to be the same at a very slightly higher level of abstraction
22:23:52
Shinmera
The interface is about how you use something, and the protocol is more about how things interact. There's an overlap, but not necessarily so.
0:18:18
z3t0
but for some reason I cannot do this when inside a function, as the item just doesn't get added... even though the return value of (push) is correct
0:18:32
Bike
(push item list) macroexpands to (setf list (cons item list)), i.e. it just alters a variable binding. the variable is bound by the function, so the push doesn't affect the caller's environment.
0:19:22
Bike
it's like, if you had (defun foo (x) (setf x (+ 5 x))) (let ((n 3)) (foo n) n) you'd get 3, not 8.
2:01:27
vsync
jasom: ah good to know... my question was more about the underlying architecture though